Skip to content

Commit 9f92456

Browse files
committed
convert inline Processes in workflow steps
1 parent 7687f47 commit 9f92456

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

cwlupgrader/main.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,27 @@ def _v1_0_to_v1_1(document):
109109
if isinstance(steps, MutableSequence):
110110
for entry in steps:
111111
upgrade_v1_0_hints_and_reqs(entry)
112+
if 'run' in entry and isinstance(entry['run'], MutableMapping):
113+
process = entry['run']
114+
_v1_0_to_v1_1(process)
115+
if 'cwlVersion' in process:
116+
del process['cwlVersion']
112117
elif isinstance(steps, MutableMapping):
113118
for step_name in steps:
114-
upgrade_v1_0_hints_and_reqs(steps[step_name])
119+
entry = steps[step_name]
120+
upgrade_v1_0_hints_and_reqs(entry)
121+
if 'run' in entry and isinstance(entry['run'], MutableMapping):
122+
process = entry['run']
123+
_v1_0_to_v1_1(process)
124+
if 'cwlVersion' in process:
125+
del process['cwlVersion']
115126
elif document['class'] == 'CommandLineTool':
116127
upgrade_v1_0_hints_and_reqs(document)
117128
move_up_loadcontents(document)
118129
network_access = has_hint_or_req(document, "NetworkAccess")
119130
listing = has_hint_or_req(document, "LoadListingRequirement")
120131
hints = document.get('hints', {})
132+
# TODO: add comments to explain the extra hints
121133
if isinstance(hints, MutableSequence):
122134
if not network_access:
123135
hints.append({"class": "NetworkAcess", "networkAccess": True})

testing.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
git clone https://github.com/common-workflow-language/common-workflow-language.git cwl-v1.0
3+
cd cwl-v1.0/v1.0
4+
cp -r v1.0 v1.1
5+
rm v1.1/*.cwl
6+
for cwl in v1.0/*.cwl; do echo ${cwl}; cwl-upgrader ${cwl} > v1.1/${cwl##v1.0/}; done
7+
cp conformance_test_v1.0.yaml conformance_test_v1.0_to_v1_1.yaml
8+
sed -i 's=v1.0/=v1.1/=g' conformance_test_v1.0_to_v1_1.yaml
9+
cwltest --test conformance_test_v1.0_to_v1_1.yaml --tool cwltool -j$(nproc)
10+
if (find v1.1/ -type f | xargs grep cwlVersion | grep v1.0) ; then false; else true; fi
11+

0 commit comments

Comments
 (0)