[arvados] updated: 2.1.0-3017-g0b39c68ee

git repository hosting git at public.arvados.org
Mon Nov 14 00:52:54 UTC 2022


Summary of changes:
 sdk/cwl/arvados_cwl/arvworkflow.py                   | 20 +++++++++++++++-----
 .../collection_per_tool_wrapper.cwl                  |  3 ++-
 sdk/cwl/tests/test_submit.py                         |  6 ++++--
 sdk/cwl/tests/wf/expect_upload_wrapper.cwl           |  3 ++-
 ...wrapper.cwl => expect_upload_wrapper_altname.cwl} |  3 ++-
 5 files changed, 25 insertions(+), 10 deletions(-)
 copy sdk/cwl/tests/wf/{expect_upload_wrapper.cwl => expect_upload_wrapper_altname.cwl} (97%)

       via  0b39c68ee38afbfec9f7d6d082a52cc2681edbea (commit)
       via  e49a01cb75572deacf6878ad53d7965ea1869d2b (commit)
      from  ee532d8ffb857bea75712fd93d450eaef161521b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 0b39c68ee38afbfec9f7d6d082a52cc2681edbea
Author: Peter Amstutz <peter.amstutz at curii.com>
Date:   Sun Nov 13 19:52:37 2022 -0500

    19688: Make sure the wrapper has git info too
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>

diff --git a/sdk/cwl/arvados_cwl/arvworkflow.py b/sdk/cwl/arvados_cwl/arvworkflow.py
index 78bc7f319..56226388d 100644
--- a/sdk/cwl/arvados_cwl/arvworkflow.py
+++ b/sdk/cwl/arvados_cwl/arvworkflow.py
@@ -39,7 +39,7 @@ metrics = logging.getLogger('arvados.cwl-runner.metrics')
 max_res_pars = ("coresMin", "coresMax", "ramMin", "ramMax", "tmpdirMin", "tmpdirMax")
 sum_res_pars = ("outdirMin", "outdirMax")
 
-def make_wrapper_workflow(arvRunner, main, packed, project_uuid, name):
+def make_wrapper_workflow(arvRunner, main, packed, project_uuid, name, git_info, tool):
     col = arvados.collection.Collection(api_client=arvRunner.api,
                                         keep_client=arvRunner.keep_client)
 
@@ -48,14 +48,18 @@ def make_wrapper_workflow(arvRunner, main, packed, project_uuid, name):
 
     pdh = col.portable_data_hash()
 
+    toolname = tool.tool.get("label") or tool.metadata.get("label") or os.path.basename(tool.tool["id"])
+    if git_info and git_info.get("http://arvados.org/cwl#gitDescribe"):
+        toolname = "%s (%s)" % (toolname, git_info.get("http://arvados.org/cwl#gitDescribe"))
+
     existing = arvRunner.api.collections().list(filters=[["portable_data_hash", "=", pdh], ["owner_uuid", "=", project_uuid]]).execute(num_retries=arvRunner.num_retries)
     if len(existing["items"]) == 0:
-        col.save_new(name=name, owner_uuid=project_uuid, ensure_unique_name=True)
+        col.save_new(name=toolname, owner_uuid=project_uuid, ensure_unique_name=True)
 
     # now construct the wrapper
 
     step = {
-        "id": "#main/" + name,
+        "id": "#main/" + toolname,
         "in": [],
         "out": [],
         "run": "keep:%s/workflow.json#main" % pdh,
@@ -105,7 +109,13 @@ def make_wrapper_workflow(arvRunner, main, packed, project_uuid, name):
     if main.get("hints"):
         wrapper["hints"] = main["hints"]
 
-    return json.dumps({"cwlVersion": "v1.2", "$graph": [wrapper]}, sort_keys=True, indent=4, separators=(',',': '))
+    doc = {"cwlVersion": "v1.2", "$graph": [wrapper]}
+
+    if git_info:
+        for g in git_info:
+            doc[g] = git_info[g]
+
+    return json.dumps(doc, sort_keys=True, indent=4, separators=(',',': '))
 
 def upload_workflow(arvRunner, tool, job_order, project_uuid,
                     runtimeContext, uuid=None,
@@ -154,7 +164,7 @@ def upload_workflow(arvRunner, tool, job_order, project_uuid,
 
     main["hints"] = hints
 
-    wrapper = make_wrapper_workflow(arvRunner, main, packed, project_uuid, name)
+    wrapper = make_wrapper_workflow(arvRunner, main, packed, project_uuid, name, git_info, tool)
 
     body = {
         "workflow": {

commit e49a01cb75572deacf6878ad53d7965ea1869d2b
Author: Peter Amstutz <peter.amstutz at curii.com>
Date:   Sun Nov 13 18:19:53 2022 -0500

    19688: Fix tests
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>

diff --git a/sdk/cwl/tests/collection_per_tool/collection_per_tool_wrapper.cwl b/sdk/cwl/tests/collection_per_tool/collection_per_tool_wrapper.cwl
index 12302f13f..fda566c88 100644
--- a/sdk/cwl/tests/collection_per_tool/collection_per_tool_wrapper.cwl
+++ b/sdk/cwl/tests/collection_per_tool/collection_per_tool_wrapper.cwl
@@ -22,8 +22,9 @@
             ],
             "steps": [
                 {
-                    "id": "#main/step",
+                    "id": "#main/collection_per_tool.cwl",
                     "in": [],
+                    "label": "collection_per_tool.cwl",
                     "out": [],
                     "run": "keep:92045991f69a417f2f26660db67911ef+61/workflow.json#main"
                 }
diff --git a/sdk/cwl/tests/test_submit.py b/sdk/cwl/tests/test_submit.py
index 55b66adcc..17c09f1ee 100644
--- a/sdk/cwl/tests/test_submit.py
+++ b/sdk/cwl/tests/test_submit.py
@@ -1592,6 +1592,8 @@ class TestCreateWorkflow(unittest.TestCase):
     existing_workflow_uuid = "zzzzz-7fd4e-validworkfloyml"
     expect_workflow = StripYAMLComments(
         open("tests/wf/expect_upload_wrapper.cwl").read().rstrip())
+    expect_workflow_altname = StripYAMLComments(
+        open("tests/wf/expect_upload_wrapper_altname.cwl").read().rstrip())
 
     def setUp(self):
         cwltool.process._names = set()
@@ -1657,7 +1659,7 @@ class TestCreateWorkflow(unittest.TestCase):
                 "owner_uuid": project_uuid,
                 "name": "testing 123",
                 "description": "",
-                "definition": self.expect_workflow,
+                "definition": self.expect_workflow_altname,
             }
         }
         stubs.api.workflows().create.assert_called_with(
@@ -1712,7 +1714,7 @@ class TestCreateWorkflow(unittest.TestCase):
             "workflow": {
                 "name": "testing 123",
                 "description": "",
-                "definition": self.expect_workflow,
+                "definition": self.expect_workflow_altname,
                 "owner_uuid": project_uuid
             }
         }
diff --git a/sdk/cwl/tests/wf/expect_upload_wrapper.cwl b/sdk/cwl/tests/wf/expect_upload_wrapper.cwl
index 78827cbc5..3821527bb 100644
--- a/sdk/cwl/tests/wf/expect_upload_wrapper.cwl
+++ b/sdk/cwl/tests/wf/expect_upload_wrapper.cwl
@@ -63,7 +63,7 @@
             ],
             "steps": [
                 {
-                    "id": "#main/step",
+                    "id": "#main/submit_wf.cwl",
                     "in": [
                         {
                             "id": "#main/step/x",
@@ -78,6 +78,7 @@
                             "source": "#main/z"
                         }
                     ],
+                    "label": "submit_wf.cwl",
                     "out": [],
                     "run": "keep:f1c2b0c514a5fb9b2a8b5b38a31bab66+61/workflow.json#main"
                 }
diff --git a/sdk/cwl/tests/wf/expect_upload_wrapper.cwl b/sdk/cwl/tests/wf/expect_upload_wrapper_altname.cwl
similarity index 97%
copy from sdk/cwl/tests/wf/expect_upload_wrapper.cwl
copy to sdk/cwl/tests/wf/expect_upload_wrapper_altname.cwl
index 78827cbc5..c37a28cc4 100644
--- a/sdk/cwl/tests/wf/expect_upload_wrapper.cwl
+++ b/sdk/cwl/tests/wf/expect_upload_wrapper_altname.cwl
@@ -63,7 +63,7 @@
             ],
             "steps": [
                 {
-                    "id": "#main/step",
+                    "id": "#main/testing 123",
                     "in": [
                         {
                             "id": "#main/step/x",
@@ -78,6 +78,7 @@
                             "source": "#main/z"
                         }
                     ],
+                    "label": "testing 123",
                     "out": [],
                     "run": "keep:f1c2b0c514a5fb9b2a8b5b38a31bab66+61/workflow.json#main"
                 }

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list