X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/5d0007f0798d34619a21e447f12c34ac2023f2fb..cc095ef1f8c86b05a8e58f15c4086a2caa861ec5:/sdk/cwl/arvados_cwl/arvcontainer.py diff --git a/sdk/cwl/arvados_cwl/arvcontainer.py b/sdk/cwl/arvados_cwl/arvcontainer.py index 4be2e2bd74..3703fc6217 100644 --- a/sdk/cwl/arvados_cwl/arvcontainer.py +++ b/sdk/cwl/arvados_cwl/arvcontainer.py @@ -17,7 +17,7 @@ import uuid import math import arvados_cwl.util -import ruamel.yaml as yaml +import ruamel.yaml from cwltool.errors import WorkflowException from cwltool.process import UnsupportedRequirement, shortname @@ -250,11 +250,7 @@ class ArvadosContainer(JobBase): container_request["container_image"] = arv_docker_get_image(self.arvrunner.api, docker_req, runtimeContext.pull_image, - runtimeContext.project_uuid, - runtimeContext.force_docker_pull, - runtimeContext.tmp_outdir_prefix, - runtimeContext.match_local_docker, - runtimeContext.copy_deps) + runtimeContext) network_req, _ = self.get_requirement("NetworkAccess") if network_req: @@ -264,7 +260,7 @@ class ArvadosContainer(JobBase): if api_req: runtime_constraints["API"] = True - use_disk_cache = (self.arvrunner.api.config()["Containers"].get("DefaultKeepCacheDisk", 0) > 0) + use_disk_cache = (self.arvrunner.api.config()["Containers"].get("DefaultKeepCacheRAM", 0) == 0) keep_cache_type_req, _ = self.get_requirement("http://arvados.org/cwl#KeepCacheTypeRequirement") if keep_cache_type_req: @@ -276,7 +272,7 @@ class ArvadosContainer(JobBase): if runtime_req: if "keep_cache" in runtime_req: if use_disk_cache: - # If DefaultKeepCacheDisk is non-zero it means we should use disk cache. + # If DefaultKeepCacheRAM is zero it means we should use disk cache. runtime_constraints["keep_cache_disk"] = math.ceil(runtime_req["keep_cache"] * 2**20) else: runtime_constraints["keep_cache_ram"] = math.ceil(runtime_req["keep_cache"] * 2**20) @@ -290,13 +286,6 @@ class ArvadosContainer(JobBase): "writable": True } - if use_disk_cache and "keep_cache_disk" not in runtime_constraints: - # Cache size wasn't explicitly set so calculate a default - # based on 2x RAM request or 1 GB per core, whichever is - # smaller. This is to avoid requesting 100s of GB of disk - # cache when requesting a node with a huge amount of RAM. - runtime_constraints["keep_cache_disk"] = min(runtime_constraints["ram"] * 2, runtime_constraints["vcpus"] * (1024*1024*1024)) - partition_req, _ = self.get_requirement("http://arvados.org/cwl#PartitionRequirement") if partition_req: scheduling_parameters["partitions"] = aslist(partition_req["partition"]) @@ -543,20 +532,23 @@ class RunnerContainer(Runner): "portable_data_hash": "%s" % workflowcollection } elif self.embedded_tool.tool.get("id", "").startswith("arvwf:"): - workflowpath = "/var/lib/cwl/workflow.json#main" - record = self.arvrunner.api.workflows().get(uuid=self.embedded_tool.tool["id"][6:33]).execute(num_retries=self.arvrunner.num_retries) - packed = yaml.safe_load(record["definition"]) + uuid, frg = urllib.parse.urldefrag(self.embedded_tool.tool["id"]) + workflowpath = "/var/lib/cwl/workflow.json#" + frg + packedtxt = self.loadingContext.loader.fetch_text(uuid) + yaml = ruamel.yaml.YAML(typ='safe', pure=True) + packed = yaml.load(packedtxt) container_req["mounts"]["/var/lib/cwl/workflow.json"] = { "kind": "json", "content": packed } container_req["properties"]["template_uuid"] = self.embedded_tool.tool["id"][6:33] else: - packed = packed_workflow(self.arvrunner, self.embedded_tool, self.merged_map, runtimeContext, git_info) + main = self.loadingContext.loader.idx["_:main"] + #print(json.dumps(main, indent=2)) workflowpath = "/var/lib/cwl/workflow.json#main" container_req["mounts"]["/var/lib/cwl/workflow.json"] = { "kind": "json", - "content": packed + "content": main } container_req["properties"].update({k.replace("http://arvados.org/cwl#", "arv:"): v for k, v in git_info.items()}) @@ -629,6 +621,9 @@ class RunnerContainer(Runner): if runtimeContext.prefer_cached_downloads: command.append("--prefer-cached-downloads") + if self.fast_parser: + command.append("--fast-parser") + command.extend([workflowpath, "/var/lib/cwl/cwl.input.json"]) container_req["command"] = command