X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/1130ddc26fde448423404b4860d650a43e981e25..49a841a5179307f0c8d84f647a71f44fb2b4b26d:/sdk/cwl/arvados_cwl/__init__.py?ds=sidebyside diff --git a/sdk/cwl/arvados_cwl/__init__.py b/sdk/cwl/arvados_cwl/__init__.py index 36fe6efbb2..7c24310bdb 100644 --- a/sdk/cwl/arvados_cwl/__init__.py +++ b/sdk/cwl/arvados_cwl/__init__.py @@ -11,6 +11,7 @@ import threading import hashlib import copy import json +import re from functools import partial import pkg_resources # part of setuptools @@ -37,8 +38,8 @@ from .pathmapper import NoFollowPathMapper from ._version import __version__ from cwltool.pack import pack -from cwltool.process import shortname, UnsupportedRequirement, getListing -from cwltool.pathmapper import adjustFileObjs, adjustDirObjs +from cwltool.process import shortname, UnsupportedRequirement, use_custom_schema +from cwltool.pathmapper import adjustFileObjs, adjustDirObjs, get_listing from cwltool.draft2tool import compute_checksums from arvados.api import OrderedJsonModel @@ -202,12 +203,6 @@ class ArvCwlRunner(object): if isinstance(obj, dict): if obj.get("writable"): raise SourceLine(obj, "writable", UnsupportedRequirement).makeError("InitialWorkDir feature 'writable: true' not supported") - if obj.get("class") == "CommandLineTool": - if self.work_api == "containers": - if obj.get("stdin"): - raise SourceLine(obj, "stdin", UnsupportedRequirement).makeError("Stdin redirection currently not suppported with --api=containers") - if obj.get("stderr"): - raise SourceLine(obj, "stderr", UnsupportedRequirement).makeError("Stderr redirection currently not suppported with --api=containers") if obj.get("class") == "DockerRequirement": if obj.get("dockerOutputDirectory"): # TODO: can be supported by containers API, but not jobs API. @@ -520,7 +515,7 @@ class ArvCwlRunner(object): self.set_crunch_output() if kwargs.get("compute_checksum"): - adjustDirObjs(self.final_output, partial(getListing, self.fs_access)) + adjustDirObjs(self.final_output, partial(get_listing, self.fs_access)) adjustFileObjs(self.final_output, partial(compute_checksums, self.fs_access)) return (self.final_output, self.final_status) @@ -628,16 +623,19 @@ def arg_parser(): # type: () -> argparse.ArgumentParser return parser def add_arv_hints(): - cache = {} + cwltool.draft2tool.ACCEPTLIST_EN_RELAXED_RE = re.compile(r".*") res = pkg_resources.resource_stream(__name__, 'arv-cwl-schema.yml') - cache["http://arvados.org/cwl"] = res.read() + use_custom_schema("v1.0", "http://arvados.org/cwl", res.read()) res.close() - document_loader, cwlnames, _, _ = cwltool.process.get_schema("v1.0") - _, extnames, _, _ = schema_salad.schema.load_schema("http://arvados.org/cwl", cache=cache) - for n in extnames.names: - if not cwlnames.has_name("http://arvados.org/cwl#"+n, ""): - cwlnames.add_name("http://arvados.org/cwl#"+n, "", extnames.get_name(n, "")) - document_loader.idx["http://arvados.org/cwl#"+n] = {} + cwltool.process.supportedProcessRequirements.extend([ + "http://arvados.org/cwl#RunInSingleContainer", + "http://arvados.org/cwl#OutputDirType", + "http://arvados.org/cwl#RuntimeConstraints", + "http://arvados.org/cwl#PartitionRequirement", + "http://arvados.org/cwl#APIRequirement", + "http://commonwl.org/cwltool#LoadListingRequirement" + ]) + def main(args, stdout, stderr, api_client=None, keep_client=None): parser = arg_parser() @@ -719,4 +717,5 @@ def main(args, stdout, stderr, api_client=None, keep_client=None): keep_client=keep_client, num_retries=runner.num_retries), resolver=partial(collectionResolver, api_client, num_retries=runner.num_retries), - logger_handler=arvados.log_handler) + logger_handler=arvados.log_handler, + custom_schema_callback=add_arv_hints)