projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch '11068-cwl-missing-docker' closes #11068
[arvados.git]
/
sdk
/
cwl
/
arvados_cwl
/
arvdocker.py
diff --git
a/sdk/cwl/arvados_cwl/arvdocker.py
b/sdk/cwl/arvados_cwl/arvdocker.py
index f83add9379c176d5cb9ad472c0778c68174058b5..0513ca02ec68ca2d0fe5f58ced9ab1c98c124844 100644
(file)
--- a/
sdk/cwl/arvados_cwl/arvdocker.py
+++ b/
sdk/cwl/arvados_cwl/arvdocker.py
@@
-1,3
+1,7
@@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
+
import logging
import sys
import threading
import logging
import sys
import threading
@@
-27,12
+31,12
@@
def arv_docker_get_image(api_client, dockerRequirement, pull_image, project_uuid
global cached_lookups_lock
with cached_lookups_lock:
if dockerRequirement["dockerImageId"] in cached_lookups:
global cached_lookups_lock
with cached_lookups_lock:
if dockerRequirement["dockerImageId"] in cached_lookups:
- return
cached_lookups[dockerRequirement["dockerImageId"]
]
+ return
dockerRequirement["dockerImageId"
]
with SourceLine(dockerRequirement, "dockerImageId", WorkflowException):
sp = dockerRequirement["dockerImageId"].split(":")
image_name = sp[0]
with SourceLine(dockerRequirement, "dockerImageId", WorkflowException):
sp = dockerRequirement["dockerImageId"].split(":")
image_name = sp[0]
- image_tag = sp[1] if len(sp) > 1 else
None
+ image_tag = sp[1] if len(sp) > 1 else
"latest"
images = arvados.commands.keepdocker.list_images_in_arv(api_client, 3,
image_name=image_name,
images = arvados.commands.keepdocker.list_images_in_arv(api_client, 3,
image_name=image_name,
@@
-40,16
+44,18
@@
def arv_docker_get_image(api_client, dockerRequirement, pull_image, project_uuid
if not images:
# Fetch Docker image if necessary.
if not images:
# Fetch Docker image if necessary.
- cwltool.docker.get_image(dockerRequirement, pull_image)
+ try:
+ cwltool.docker.get_image(dockerRequirement, pull_image)
+ except OSError as e:
+ raise WorkflowException("While trying to get Docker image '%s', failed to execute 'docker': %s" % (dockerRequirement["dockerImageId"], e))
# Upload image to Arvados
args = []
if project_uuid:
args.append("--project-uuid="+project_uuid)
args.append(image_name)
# Upload image to Arvados
args = []
if project_uuid:
args.append("--project-uuid="+project_uuid)
args.append(image_name)
- if image_tag:
- args.append(image_tag)
- logger.info("Uploading Docker image %s", ":".join(args[1:]))
+ args.append(image_tag)
+ logger.info("Uploading Docker image %s:%s", image_name, image_tag)
try:
arvados.commands.keepdocker.main(args, stdout=sys.stderr)
except SystemExit as e:
try:
arvados.commands.keepdocker.main(args, stdout=sys.stderr)
except SystemExit as e:
@@
-63,12
+69,10
@@
def arv_docker_get_image(api_client, dockerRequirement, pull_image, project_uuid
if not images:
raise WorkflowException("Could not find Docker image %s:%s" % (image_name, image_tag))
if not images:
raise WorkflowException("Could not find Docker image %s:%s" % (image_name, image_tag))
- pdh = api_client.collections().get(uuid=images[0][0]).execute()["portable_data_hash"]
-
with cached_lookups_lock:
with cached_lookups_lock:
- cached_lookups[dockerRequirement["dockerImageId"]] =
pdh
+ cached_lookups[dockerRequirement["dockerImageId"]] =
True
- return pdh
+ return dockerRequirement["dockerImageId"]
def arv_docker_clear_cache():
global cached_lookups
def arv_docker_clear_cache():
global cached_lookups