Skip to content

Commit 4f675ae

Browse files
committed
Adding instance ID to repr strings, improving readability of WorkflowStep's repr string, and adding docstrings.
Also adding docstring to parallel_steps() because pydocstyle yelled about it. At first it also yelled about object_from_state() and now it doesn't, so... I guess we'll see what the CI run says because I'm not familiar enough with this function to write a docstring for it.
1 parent a96e054 commit 4f675ae

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

cwltool/workflow.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,4 +455,11 @@ def visit(self, op: Callable[[CommentedMap], None]) -> None:
455455
self.embedded_tool.visit(op)
456456

457457
def __repr__(self) -> str:
458-
return f"<{self.__class__.__name__} [{os.path.basename(self.id)}]>"
458+
"""Return a non-expression string representation of the object instance."""
459+
if "#" in self.id:
460+
wf_file, step_id = self.id.rsplit("#", 1)
461+
step_name = "#".join([os.path.basename(wf_file), step_id])
462+
else:
463+
step_name = self.id
464+
465+
return f"<{self.__class__.__name__} [{step_name}] at {hex(id(self))}>"

cwltool/workflow_job.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ def job(
6767
yield from self.step.job(joborder, output_callback, runtimeContext)
6868

6969
def __repr__(self) -> str:
70-
return f"<{self.__class__.__name__} [{self.name}]>"
70+
"""Return a non-expression string representation of the object instance."""
71+
return f"<{self.__class__.__name__} [{self.name}] at {hex(id(self))}>"
7172

7273

7374
class ReceiveScatterOutput:
@@ -137,6 +138,7 @@ def parallel_steps(
137138
rc: ReceiveScatterOutput,
138139
runtimeContext: RuntimeContext,
139140
) -> JobsGeneratorType:
141+
"""Yield scatter jobs (or None if there's no work to do) until all scatter jobs complete."""
140142
while rc.completed < rc.total:
141143
made_progress = False
142144
for index, step in enumerate(steps):
@@ -859,7 +861,8 @@ def job(
859861
# or all outputs have been produced.
860862

861863
def __repr__(self) -> str:
862-
return f"<{self.__class__.__name__} [{self.name}]>"
864+
"""Return a non-expression string representation of the object instance."""
865+
return f"<{self.__class__.__name__} [{self.name}] at {hex(id(self))}>"
863866

864867

865868
class WorkflowJobLoopStep:

0 commit comments

Comments
 (0)