X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/c56d04266de4e97b1b861c068309476ca562d72f..cd4a811b896da640e5b8ddca7e515f19085932d4:/sdk/cwl/arvados_cwl/__init__.py diff --git a/sdk/cwl/arvados_cwl/__init__.py b/sdk/cwl/arvados_cwl/__init__.py index 2b2acd5688..6f2255b3f8 100644 --- a/sdk/cwl/arvados_cwl/__init__.py +++ b/sdk/cwl/arvados_cwl/__init__.py @@ -16,43 +16,6 @@ import sys import re import pkg_resources # part of setuptools -### begin monkey patch ### -# Monkey patch solution for bug #16169 -# -# There is a bug in upstream cwltool where the version updater needs -# to replace the document fragments in the loader index with the -# updated ones, but actually it only does it for the root document. -# Normally we just fix the bug in upstream but that's challenging -# because current cwltool dropped support for Python 2.7 and we're -# still supporting py2 in Arvados 2.0 (although py2 support will most -# likely be dropped in Arvados 2.1). Making a bugfix fork comes with -# its own complications (it would need to be added to PyPi) so monkey -# patching is the least disruptive fix (and is relatively safe because -# our cwltool dependency is pinned to a specific version). This -# should be removed as soon as a bugfix goes into upstream cwltool and -# we upgrade to it. -# -import cwltool.load_tool -from cwltool.utils import visit_class -from six.moves import urllib -original_resolve_and_validate_document = cwltool.load_tool.resolve_and_validate_document -def wrapped_resolve_and_validate_document( - loadingContext, # type: LoadingContext - workflowobj, # type: Union[CommentedMap, CommentedSeq] - uri, # type: Text - preprocess_only=False, # type: bool - skip_schemas=None, # type: Optional[bool] - ): - loadingContext, uri = original_resolve_and_validate_document(loadingContext, workflowobj, uri, preprocess_only, skip_schemas) - if loadingContext.do_update in (True, None): - fileuri = urllib.parse.urldefrag(uri)[0] - def update_index(pr): - loadingContext.loader.idx[pr["id"]] = pr - visit_class(loadingContext.loader.idx[fileuri], ("CommandLineTool", "Workflow", "ExpressionTool"), update_index) - return loadingContext, uri -cwltool.load_tool.resolve_and_validate_document = wrapped_resolve_and_validate_document -### end monkey patch ### - from schema_salad.sourceline import SourceLine import schema_salad.validate as validate import cwltool.main @@ -60,7 +23,7 @@ import cwltool.workflow import cwltool.process import cwltool.argparser from cwltool.process import shortname, UnsupportedRequirement, use_custom_schema -from cwltool.pathmapper import adjustFileObjs, adjustDirObjs, get_listing +from cwltool.utils import adjustFileObjs, adjustDirObjs, get_listing import arvados import arvados.config @@ -213,7 +176,7 @@ def arg_parser(): # type: () -> argparse.ArgumentParser parser.add_argument("--enable-dev", action="store_true", help="Enable loading and running development versions " - "of CWL spec.", default=False) + "of the CWL standards.", default=False) parser.add_argument('--storage-classes', default="default", help="Specify comma separated list of storage classes to be used when saving workflow output to Keep.") @@ -257,8 +220,8 @@ def add_arv_hints(): cwltool.command_line_tool.ACCEPTLIST_RE = cwltool.command_line_tool.ACCEPTLIST_EN_RELAXED_RE res10 = pkg_resources.resource_stream(__name__, 'arv-cwl-schema-v1.0.yml') res11 = pkg_resources.resource_stream(__name__, 'arv-cwl-schema-v1.1.yml') - customschema10 = res10.read() - customschema11 = res11.read() + customschema10 = res10.read().decode('utf-8') + customschema11 = res11.read().decode('utf-8') use_custom_schema("v1.0", "http://arvados.org/cwl", customschema10) use_custom_schema("v1.1.0-dev1", "http://arvados.org/cwl", customschema11) use_custom_schema("v1.1", "http://arvados.org/cwl", customschema11)