diff --git a/reana_workflow_engine_cwl/cwl_reana.py b/reana_workflow_engine_cwl/cwl_reana.py index ef4830a..a5f7519 100644 --- a/reana_workflow_engine_cwl/cwl_reana.py +++ b/reana_workflow_engine_cwl/cwl_reana.py @@ -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 @@ -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: @@ -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( diff --git a/reana_workflow_engine_cwl/pipeline.py b/reana_workflow_engine_cwl/pipeline.py index debb16c..54653b8 100644 --- a/reana_workflow_engine_cwl/pipeline.py +++ b/reana_workflow_engine_cwl/pipeline.py @@ -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" diff --git a/reana_workflow_engine_cwl/tasks.py b/reana_workflow_engine_cwl/tasks.py index 937ab5a..aa6ffd3 100644 --- a/reana_workflow_engine_cwl/tasks.py +++ b/reana_workflow_engine_cwl/tasks.py @@ -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, @@ -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, diff --git a/requirements.txt b/requirements.txt index d440158..bc7e364 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 @@ -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 diff --git a/setup.py b/setup.py index 8814673..c5f89d2 100644 --- a/setup.py +++ b/setup.py @@ -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", ] diff --git a/tests/test_tasks.py b/tests/test_tasks.py deleted file mode 100644 index 5a1551d..0000000 --- a/tests/test_tasks.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# -# This file is part of REANA. -# Copyright (C) 2020 CERN. -# -# REANA is free software; you can redistribute it and/or modify it -# under the terms of the MIT License; see LICENSE file for more details. -"""REANA-Workflow-Engine-CWL tasks tests.""" - - -def test_parse_str_to_int(): - """Test parse_str_to_int""" - from reana_workflow_engine_cwl.tasks import parse_str_to_int - - assert parse_str_to_int({"sleeptime": "'2'"}) == {"sleeptime": 2} - assert parse_str_to_int({"sleeptime": "2"}) == {"sleeptime": 2} - assert parse_str_to_int({"sleeptime": "two"}) == {"sleeptime": "two"} - assert parse_str_to_int({"helloworld": {"class": "File"}}) == { - "helloworld": {"class": "File"} - }