[ARVADOS] created: 966d1e9fbf78494570cb64c01a9a710e4cb801c0

Git user git at public.curoverse.com
Thu Oct 27 22:00:18 EDT 2016


        at  966d1e9fbf78494570cb64c01a9a710e4cb801c0 (commit)


commit 966d1e9fbf78494570cb64c01a9a710e4cb801c0
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Thu Oct 27 21:54:14 2016 -0400

    9849: Cache docker lookup.

diff --git a/sdk/cwl/arvados_cwl/arvdocker.py b/sdk/cwl/arvados_cwl/arvdocker.py
index 244dd3d..1ab8471 100644
--- a/sdk/cwl/arvados_cwl/arvdocker.py
+++ b/sdk/cwl/arvados_cwl/arvdocker.py
@@ -8,12 +8,17 @@ import arvados.commands.keepdocker
 
 logger = logging.getLogger('arvados.cwl-runner')
 
+cached_lookups = {}
+
 def arv_docker_get_image(api_client, dockerRequirement, pull_image, project_uuid):
     """Check if a Docker image is available in Keep, if not, upload it using arv-keepdocker."""
 
     if "dockerImageId" not in dockerRequirement and "dockerPull" in dockerRequirement:
         dockerRequirement["dockerImageId"] = dockerRequirement["dockerPull"]
 
+    if dockerRequirement["dockerImageId"] in cached_lookups:
+        return cached_lookups[dockerRequirement["dockerImageId"]]
+
     sp = dockerRequirement["dockerImageId"].split(":")
     image_name = sp[0]
     image_tag = sp[1] if len(sp) > 1 else None
@@ -44,4 +49,7 @@ def arv_docker_get_image(api_client, dockerRequirement, pull_image, project_uuid
         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"]
+
+    cached_lookups[dockerRequirement["dockerImageId"]] = pdh
+
     return pdh

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list