Skip to content

Commit

Permalink
Add two overrides for cwltool --pack bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdbeek committed Nov 6, 2023
1 parent 557e64c commit b8a3a5c
Showing 1 changed file with 88 additions and 1 deletion.
89 changes: 88 additions & 1 deletion lib/galaxy_test/base/cwl_location_rewriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,89 @@

log = logging.getLogger(__name__)

# https://github.com/common-workflow-language/cwltool/issues/1937
PACKED_WORKFLOWS_CWL_BUG = {
"conflict-wf.cwl": """
$graph:
- baseCommand: echo
class: CommandLineTool
id: echo
inputs:
text:
inputBinding: {}
type: string
outputs:
fileout:
outputBinding: {glob: out.txt}
type: File
stdout: out.txt
- baseCommand: cat
class: CommandLineTool
id: cat
inputs:
file1:
inputBinding: {position: 1}
type: File
file2:
inputBinding: {position: 2}
type: File
outputs:
fileout:
outputBinding: {glob: out.txt}
type: File
stdout: out.txt
- class: Workflow
id: collision
inputs: {input_1: string, input_2: string}
outputs:
fileout: {outputSource: cat_step/fileout, type: File}
steps:
cat_step:
in:
file1: {source: echo_1/fileout}
file2: {source: echo_2/fileout}
out: [fileout]
run: '#cat'
echo_1:
in: {text: input_1}
out: [fileout]
run: '#echo'
echo_2:
in: {text: input_2}
out: [fileout]
run: '#echo'
cwlVersion: v1.1
""",
"js-expr-req-wf.cwl": """
$graph:
- arguments: [echo, $(foo())]
class: CommandLineTool
hints:
ResourceRequirement: {ramMin: 8}
id: tool
inputs: []
outputs: {out: stdout}
requirements:
InlineJavascriptRequirement:
expressionLib: ['function foo() { return 2; }']
stdout: whatever.txt
- class: Workflow
id: wf
inputs: []
outputs:
out: {outputSource: tool/out, type: File}
requirements:
InlineJavascriptRequirement:
expressionLib: ['function bar() { return 1; }']
steps:
tool:
in: {}
out: [out]
run: '#tool'
cwlVersion: v1.0
""",
}


def get_cwl_test_url(cwl_version):
branch = "main"
Expand Down Expand Up @@ -42,6 +125,11 @@ def get_url(item, cwl_version, base_dir):


def rewrite_locations(workflow_path: str, output_path: str):
workflow_path_basename = os.path.basename(workflow_path)
if workflow_path_basename in PACKED_WORKFLOWS_CWL_BUG:
with open(output_path, "w") as output:
output.write(PACKED_WORKFLOWS_CWL_BUG[workflow_path_basename])
return
loading_context, workflow_obj, _uri = fetch_document(workflow_path)
workflow_obj = pack(loading_context, workflow_path)
cwl_version = workflow_path.split("test/functional/tools/cwl_tools/v")[1].split("/")[0]
Expand All @@ -54,4 +142,3 @@ def rewrite_locations(workflow_path: str, output_path: str):
)
with open(output_path, "w") as output:
json.dump(workflow_obj, output)
return workflow_obj

0 comments on commit b8a3a5c

Please sign in to comment.