Skip to content

Commit 8e0b6f2

Browse files
AlexTatemr-c
authored andcommitted
Adding __repr__ to WorkflowStep, WorkflowJob, and WorkflowJobStep classes. This can be VERY helpful while debugging, particularly when unraveling callback chains.
1 parent b639dfa commit 8e0b6f2

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

cwltool/workflow.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
import copy
23
import datetime
34
import functools
@@ -452,3 +453,6 @@ def job(
452453

453454
def visit(self, op: Callable[[CommentedMap], None]) -> None:
454455
self.embedded_tool.visit(op)
456+
457+
def __repr__(self):
458+
return f"<{self.__class__.__name__} [{os.path.basename(self.id)}]>"

cwltool/workflow_job.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ def job(
6666

6767
yield from self.step.job(joborder, output_callback, runtimeContext)
6868

69+
def __repr__(self):
70+
return f"<{self.__class__.__name__} [{self.name}]>"
71+
6972

7073
class ReceiveScatterOutput:
7174
"""Produced by the scatter generators."""
@@ -851,6 +854,8 @@ def job(
851854
# depends which one comes first. All steps are completed
852855
# or all outputs have been produced.
853856

857+
def __repr__(self):
858+
return f"<{self.__class__.__name__} [{self.name}]>"
854859

855860
class WorkflowJobLoopStep:
856861
"""Generated for each step in Workflow.steps() containing a `loop` directive."""

0 commit comments

Comments
 (0)