Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for sub workflows #103

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions cwl_utils/docker_extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
)

ProcessType = Union[cwl.Workflow, cwl.CommandLineTool, cwl.ExpressionTool]

WorkflowDir = ""

def parse_args() -> argparse.Namespace:
"""Argument parser."""
Expand All @@ -34,9 +34,11 @@ def parse_args() -> argparse.Namespace:

def main(args: argparse.Namespace) -> None:
"""Extract the docker reqs and download them using Singularity or docker."""
global WorkflowDir
os.makedirs(args.dir, exist_ok=True)

top = cwl.load_document(args.input)
WorkflowDir = str(Path(args.input).parent)+"/"

for req in traverse(top):
if not req.dockerPull:
Expand Down Expand Up @@ -85,8 +87,9 @@ def traverse(process: ProcessType) -> Iterator[cwl.DockerRequirement]:

def get_process_from_step(step: cwl.WorkflowStep) -> ProcessType:
"""Return the process for this step, loading it if necessary."""
global WorkflowDir
if isinstance(step.run, str):
return cast(ProcessType, cwl.load_document(step.run))
return cast(ProcessType, cwl.load_document(WorkflowDir+step.run))
return cast(ProcessType, step.run)


Expand Down