File tree Expand file tree Collapse file tree 5 files changed +14
-8
lines changed Expand file tree Collapse file tree 5 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -152,9 +152,15 @@ class Task(ty.Generic[OutputsType]):
152
152
# Task type to be overridden in derived classes
153
153
@classmethod
154
154
def _task_type (cls ) -> str :
155
- mod_parts = cls .__module__ .split ("." )
156
- assert mod_parts [:2 ] == ["pydra" , "compose" ]
157
- return mod_parts [2 ]
155
+ for base in cls .__mro__ :
156
+ parts = base .__module__ .split ("." )
157
+ if parts [:2 ] == ["pydra" , "compose" ]:
158
+ return parts [2 ]
159
+ raise RuntimeError (
160
+ f"Cannot determine task type for { cls .__name__ } in module { cls .__module__ } "
161
+ "because none of its base classes are in the pydra.compose namespace:\n "
162
+ + "\n " .join (f"{ b .__name__ !r} in { b .__module__ !r} " for b in cls .__mro__ )
163
+ )
158
164
159
165
# The attribute containing the function/executable used to run the task
160
166
_executor_name = None
Original file line number Diff line number Diff line change @@ -219,7 +219,7 @@ def _from_job(cls, job: "Job[PythonTask]") -> ty.Self:
219
219
outputs : Outputs
220
220
The outputs of the job in dataclass
221
221
"""
222
- outputs = super ()._from_task (job )
222
+ outputs = super ()._from_job (job )
223
223
for name , val in job .return_values .items ():
224
224
setattr (outputs , name , val )
225
225
return outputs
Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ def _from_job(cls, job: "Job[Task]") -> ty.Self:
78
78
outputs : Outputs
79
79
The outputs of the shell process
80
80
"""
81
- outputs = super ()._from_task (job )
81
+ outputs = super ()._from_job (job )
82
82
fld : field .out
83
83
for fld in task_fields (cls ):
84
84
if fld .name in ["return_code" , "stdout" , "stderr" ]:
Original file line number Diff line number Diff line change @@ -340,7 +340,7 @@ def _from_job(cls, job: "Job[WorkflowTask]") -> ty.Self:
340
340
values [name ] = val_out
341
341
342
342
# Set the values in the outputs object
343
- outputs = super ()._from_task (job )
343
+ outputs = super ()._from_job (job )
344
344
outputs = attrs .evolve (outputs , ** values )
345
345
outputs ._cache_dir = job .cache_dir
346
346
return outputs
Original file line number Diff line number Diff line change @@ -331,7 +331,7 @@ def run(self, rerun: bool = False):
331
331
try :
332
332
self .audit .monitor ()
333
333
self .task ._run (self , rerun )
334
- result .outputs = self .task .Outputs ._from_task (self )
334
+ result .outputs = self .task .Outputs ._from_job (self )
335
335
except Exception :
336
336
etype , eval , etr = sys .exc_info ()
337
337
traceback = format_exception (etype , eval , etr )
@@ -385,7 +385,7 @@ async def run_async(self, rerun: bool = False) -> Result:
385
385
try :
386
386
self .audit .monitor ()
387
387
await self .task ._run_async (self , rerun )
388
- result .outputs = self .task .Outputs ._from_task (self )
388
+ result .outputs = self .task .Outputs ._from_job (self )
389
389
except Exception :
390
390
etype , eval , etr = sys .exc_info ()
391
391
traceback = format_exception (etype , eval , etr )
You can’t perform that action at this time.
0 commit comments