X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/fbffa8c4d0fa8bd19fe77b82c16395b80f0bb0ce..ba34a22d9918ae97306472c04701e69090821c82:/sdk/cwl/arvados_cwl/__init__.py diff --git a/sdk/cwl/arvados_cwl/__init__.py b/sdk/cwl/arvados_cwl/__init__.py index 71ef742e31..550ecba1c1 100644 --- a/sdk/cwl/arvados_cwl/__init__.py +++ b/sdk/cwl/arvados_cwl/__init__.py @@ -36,6 +36,7 @@ from arvados.api import OrderedJsonModel from .perf import Perf from ._version import __version__ from .executor import ArvCwlExecutor +from .fsaccess import workflow_uuid_pattern # These aren't used directly in this file but # other code expects to import them from here @@ -152,6 +153,10 @@ def arg_parser(): # type: () -> argparse.ArgumentParser help="When invoked with --submit --wait, always submit a runner to manage the workflow, even when only running a single CommandLineTool", default=False) + parser.add_argument("--match-submitter-images", action="store_true", + default=False, dest="match_local_docker", + help="Where Arvados has more than one Docker image of the same name, use image from the Docker instance on the submitting node.") + exgroup = parser.add_mutually_exclusive_group() exgroup.add_argument("--submit-request-uuid", default=None, @@ -195,6 +200,10 @@ def arg_parser(): # type: () -> argparse.ArgumentParser action="store_false", default=True, help=argparse.SUPPRESS) + parser.add_argument("--disable-git", dest="git_info", + action="store_false", default=True, + help=argparse.SUPPRESS) + parser.add_argument("--disable-color", dest="enable_color", action="store_false", default=True, help=argparse.SUPPRESS) @@ -209,6 +218,23 @@ def arg_parser(): # type: () -> argparse.ArgumentParser parser.add_argument("--http-timeout", type=int, default=5*60, dest="http_timeout", help="API request timeout in seconds. Default is 300 seconds (5 minutes).") + parser.add_argument("--defer-downloads", action="store_true", default=False, + help="When submitting a workflow, defer downloading HTTP URLs to workflow launch instead of downloading to Keep before submit.") + + parser.add_argument("--varying-url-params", type=str, default="", + help="A comma separated list of URL query parameters that should be ignored when storing HTTP URLs in Keep.") + + parser.add_argument("--prefer-cached-downloads", action="store_true", default=False, + help="If a HTTP URL is found in Keep, skip upstream URL freshness check (will not notice if the upstream has changed, but also not error if upstream is unavailable).") + + exgroup = parser.add_mutually_exclusive_group() + exgroup.add_argument("--enable-preemptible", dest="enable_preemptible", default=None, action="store_true", help="Use preemptible instances. Control individual steps with arv:UsePreemptible hint.") + exgroup.add_argument("--disable-preemptible", dest="enable_preemptible", default=None, action="store_false", help="Don't use preemptible instances.") + + exgroup = parser.add_mutually_exclusive_group() + exgroup.add_argument("--copy-deps", dest="copy_deps", default=None, action="store_true", help="Copy dependencies into the destination project.") + exgroup.add_argument("--no-copy-deps", dest="copy_deps", default=None, action="store_false", help="Leave dependencies where they are.") + parser.add_argument( "--skip-schemas", action="store_true", @@ -250,14 +276,21 @@ def add_arv_hints(): "http://arvados.org/cwl#ReuseRequirement", "http://arvados.org/cwl#ClusterTarget", "http://arvados.org/cwl#OutputStorageClass", - "http://arvados.org/cwl#ProcessProperties" + "http://arvados.org/cwl#ProcessProperties", + "http://commonwl.org/cwltool#CUDARequirement", + "http://arvados.org/cwl#UsePreemptible", + "http://arvados.org/cwl#OutputCollectionProperties", ]) def exit_signal_handler(sigcode, frame): logger.error(str(u"Caught signal {}, exiting.").format(sigcode)) sys.exit(-sigcode) -def main(args, stdout, stderr, api_client=None, keep_client=None, +def main(args=sys.argv[1:], + stdout=sys.stdout, + stderr=sys.stderr, + api_client=None, + keep_client=None, install_sig_handlers=True): parser = arg_parser() @@ -300,7 +333,8 @@ def main(args, stdout, stderr, api_client=None, keep_client=None, # Make an API object now so errors are reported early. api_client.users().current().execute() if keep_client is None: - keep_client = arvados.keep.KeepClient(api_client=api_client, num_retries=4) + block_cache = arvados.keep.KeepBlockCache(disk_cache=True) + keep_client = arvados.keep.KeepClient(api_client=api_client, num_retries=4, block_cache=block_cache) executor = ArvCwlExecutor(api_client, arvargs, keep_client=keep_client, num_retries=4, stdout=stdout) except WorkflowException as e: logger.error(e, exc_info=(sys.exc_info()[1] if arvargs.debug else False)) @@ -340,6 +374,10 @@ def main(args, stdout, stderr, api_client=None, keep_client=None, # unit tests. stdout = None + if arvargs.submit and (arvargs.workflow.startswith("arvwf:") or workflow_uuid_pattern.match(arvargs.workflow)): + executor.loadingContext.do_validate = False + executor.fast_submit = True + return cwltool.main.main(args=arvargs, stdout=stdout, stderr=stderr, @@ -349,5 +387,5 @@ def main(args, stdout, stderr, api_client=None, keep_client=None, logger_handler=arvados.log_handler, custom_schema_callback=add_arv_hints, loadingContext=executor.loadingContext, - runtimeContext=executor.runtimeContext, + runtimeContext=executor.toplevel_runtimeContext, input_required=not (arvargs.create_workflow or arvargs.update_workflow))