Hi *, again I'm including the list into this reply, as I think it is of more general interest.
Jody asks: > When I reduced my class to this: > ---- > from gc3libs.workflow import StagedTaskCollection > from gc3libs import Run > > class WarholizePipeApp(StagedTaskCollection): > """ sequence of tasks to do warholize """ > > def __init__(self, N, img, body, finaldir): > StagedTaskCollection.__init__(self, output_dir="warhol.tmp.dir") > #-- end def > > def stage0(self): > return Run.State.TERMINATED > #-- end def > ---- > I am told: > ---- > File "/home/centos/course/WarholizeScript.py", line 30, in new_tasks > apps=[WarholizePipeApp(self.params.N, self.params.img, body, > self.params.finaldir)] > File "/home/centos/course/WarholizePipeApp.py", line 16, in __init__ > StagedTaskCollection.__init__(self, output_dir="warhol.tmp.dir") > File > "/home/centos/gc3pie/lib/python2.7/site-packages/gc3libs/workflow.py", line > 564, in __init__ > " must return `Task` instance or number" % self) > AssertionError: Invalid return value from method `stage0()` of > `StagedTaskCollection` object <WarholizePipeApp.WarholizePipeApp object at > 0x132dc50>: must return `Task` instance or number > ---- > > Interestingly here again the stack indicates the constructor as being the > source of the error, even though the error happens in stage0? Because the `StagedTaskCollection.__init__()` constructor invokes `stage0()` to build the initial list of tasks (`StagedTaskCollection.__init__()` has to call `SequentialTaskCollection.__init__()`). See https://github.com/uzh/gc3pie/blob/master/gc3libs/workflow.py#L689 up to line 708 for more details. > Why is it wrong to use Run.State.TERMINATED there? The `stageN` interface only allows two possible return values: - a `Task`/`Application` instance, which will be executed next, or - a return code (integer or pair of integers), which is used to set the collection's termination status, and the state is set to TERMINATED as a side effect. Again, I see that the slides in the "programmers' tutorial" were wrong; I have now fixed this -- many thanks for reporting! Ciao, R -- Riccardo Murri http://www.s3it.uzh.ch/about/team/#Riccardo.Murri S3IT: Services and Support for Science IT University of Zurich Winterthurerstrasse 190, CH-8057 Zürich (Switzerland) Tel: +41 44 635 4208 Fax: +41 44 635 6888 -- You received this message because you are subscribed to the Google Groups "gc3pie" group. To unsubscribe from this group and stop receiving emails from it, send an email to gc3pie+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.