Skip to content

Commit

Permalink
cwltool: upgrade to the latest version
Browse files Browse the repository at this point in the history
closes #187
  • Loading branch information
audrium committed Aug 27, 2021
1 parent 1b571e1 commit 0bf38f4
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 65 deletions.
10 changes: 8 additions & 2 deletions reana_workflow_engine_cwl/cwl_reana.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
relink_initialworkdir,
stage_files,
)
from cwltool.pathmapper import ensure_writable
from cwltool.utils import ensure_writable
from cwltool.workflow import default_make_tool
from reana_commons.api_client import JobControllerAPIClient as rjc_api_client
from reana_commons.config import REANA_WORKFLOW_UMASK
Expand Down Expand Up @@ -280,6 +280,13 @@ def shouldquote(x):

return create_body

def _required_env(self):
"""Variables required by the CWL spec."""
return {
"TMPDIR": self.tmpdir,
"HOME": self.builder.outdir,
}

def _get_hint(self, hint_name):
"""Return specific hint if specified."""
if self.hints:
Expand Down Expand Up @@ -382,7 +389,6 @@ def callback(rcode):
finally:
if self.outputs is not None:
log.info(f"[job {self.name}] OUTPUTS ------------------")
log.info(pformat(self.outputs))
self.cleanup(runtimeContext.rm_tmpdir)

poll = ReanaPipelinePoll(
Expand Down
2 changes: 2 additions & 0 deletions reana_workflow_engine_cwl/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ def output_callback(out, processStatus):
cleanIntermediate(output_dirs)

if final_output and final_status:
output = str(final_output[0]).encode("utf8").decode("unicode_escape")
log.info(f"FinalOutput{output}FinalOutput")
return str(final_output[0]), str(final_status[0])
else:
return None, "permanentFail"
Expand Down
17 changes: 0 additions & 17 deletions reana_workflow_engine_cwl/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,6 @@ def rcode_to_workflow_status(response_code):
return rcode_to_workflow_status_mapping[response_code]


def parse_str_to_int(workflow_parameters):
"""Parse integers stored as strings to integers."""
for (key, val) in workflow_parameters.items():
try:
if isinstance(val, str) and val[0] == "'":
# The actual value of the int as str could be stored as:
# '\'val\'', since ' is an escape character.
workflow_parameters[key] = int(val[1:-1])
else:
workflow_parameters[key] = int(val)
except (ValueError, TypeError, KeyError):
# Skip values and types which cannot be casted to integer.
pass
return workflow_parameters


def run_cwl_workflow_engine_adapter(
publisher,
rjc_api_client,
Expand All @@ -53,7 +37,6 @@ def run_cwl_workflow_engine_adapter(
**kwargs,
):
"""Run cwl workflow."""
workflow_parameters = parse_str_to_int(workflow_parameters)
log.info(f"running workflow on context: {locals()}")
rcode = main.main(
publisher,
Expand Down
47 changes: 23 additions & 24 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,21 @@
#
amqp==2.6.1 # via kombu
appdirs==1.4.4 # via fs
argcomplete==1.12.3 # via cwltool
attrs==21.2.0 # via jsonschema
bagit==1.8.1 # via cwltool
bravado-core==5.17.0 # via bravado
bravado==10.3.2 # via reana-commons
cachecontrol==0.11.7 # via schema-salad
cachecontrol==0.12.6 # via schema-salad
certifi==2021.5.30 # via requests
chardet==4.0.0 # via requests
charset-normalizer==2.0.4 # via requests
checksumdir==1.1.9 # via reana-commons
click==8.0.1 # via reana-commons
coloredlogs==15.0.1 # via cwltool
cwltool==1.0.20191022103248 # via reana-workflow-engine-cwl (setup.py)
decorator==4.4.2 # via networkx
cwltool==3.1.20210628163208 # via reana-workflow-engine-cwl (setup.py)
fs==2.4.13 # via reana-commons
future==0.18.2 # via cwltool, schema-salad
humanfriendly==9.2 # via coloredlogs
idna==2.10 # via jsonschema, requests
idna==3.2 # via jsonschema, requests
isodate==0.6.0 # via rdflib
jsonpointer==2.1 # via jsonschema
jsonref==0.2 # via bravado-core
Expand All @@ -33,32 +32,32 @@ mistune==0.8.4 # via schema-salad
mock==3.0.5 # via reana-commons
monotonic==1.6 # via bravado
msgpack-python==0.5.6 # via bravado
msgpack==1.0.2 # via bravado-core
msgpack==1.0.2 # via bravado-core, cachecontrol
mypy-extensions==0.4.3 # via cwltool
networkx==2.5.1 # via prov
pathlib2==2.3.5 # via cwltool
networkx==2.6.2 # via prov
prov==1.5.1 # via cwltool
psutil==5.8.0 # via cwltool
pyparsing==2.4.7 # via rdflib
pyrsistent==0.17.3 # via jsonschema
python-dateutil==2.8.1 # via bravado, bravado-core, prov
pydot==1.4.2 # via cwltool
pyparsing==2.4.7 # via pydot, rdflib
pyrsistent==0.18.0 # via jsonschema
python-dateutil==2.8.2 # via bravado, bravado-core, prov
pytz==2021.1 # via bravado-core, fs
pyyaml==5.4.1 # via bravado, bravado-core, reana-commons
rdflib-jsonld==0.4.0 # via schema-salad
rdflib==4.2.2 # via cwltool, prov, rdflib-jsonld, schema-salad
reana-commons==0.8.0a21 # via reana-workflow-engine-cwl (setup.py)
requests==2.25.1 # via bravado, cachecontrol, cwltool, schema-salad
rdflib-jsonld==0.5.0 # via schema-salad
rdflib==5.0.0 # via cwltool, prov, rdflib-jsonld, schema-salad
reana-commons==0.8.0a22 # via reana-workflow-engine-cwl (setup.py)
requests==2.26.0 # via bravado, cachecontrol, cwltool, schema-salad
rfc3987==1.3.8 # via jsonschema
ruamel.yaml==0.16.0 # via cwltool, schema-salad
scandir==1.10.0 # via cwltool
schema-salad==4.5.20191023134839 # via cwltool, reana-workflow-engine-cwl (setup.py)
shellescape==3.4.1 # via cwltool
simplejson==3.17.2 # via bravado, bravado-core
six==1.16.0 # via bravado, bravado-core, cwltool, fs, isodate, jsonschema, mock, pathlib2, prov, python-dateutil, schema-salad
ruamel.yaml.clib==0.2.6 # via ruamel.yaml
ruamel.yaml==0.17.10 # via cwltool, schema-salad
schema-salad==8.1.20210721123742 # via cwltool
shellescape==3.8.1 # via cwltool
simplejson==3.17.5 # via bravado, bravado-core
six==1.16.0 # via bravado, bravado-core, fs, isodate, jsonschema, mock, prov, python-dateutil, rdflib
strict-rfc3339==0.7 # via jsonschema
swagger-spec-validator==2.7.3 # via bravado-core
typing-extensions==3.10.0.0 # via bravado, cwltool, schema-salad
urllib3==1.26.5 # via requests
typing-extensions==3.10.0.0 # via bravado, cwltool
urllib3==1.26.6 # via requests
vine==1.3.0 # via amqp
webcolors==1.11.1 # via jsonschema
werkzeug==2.0.1 # via reana-commons
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@
]

install_requires = [
"cwltool==1.0.20191022103248",
"schema-salad==4.5.20191023134839",
"cwltool==3.1.20210628163208",
"reana-commons>=0.8.0a21,<0.9.0",
]

Expand Down
20 changes: 0 additions & 20 deletions tests/test_tasks.py

This file was deleted.

0 comments on commit 0bf38f4

Please sign in to comment.