[ARVADOS] created: 11eae1a76ec028044b2beaa3fdc53daac4c26f5e

Git user git at public.curoverse.com
Mon Dec 5 15:36:29 EST 2016


        at  11eae1a76ec028044b2beaa3fdc53daac4c26f5e (commit)


commit 11eae1a76ec028044b2beaa3fdc53daac4c26f5e
Author: Jiayong Li <jiayong at math.mit.edu>
Date:   Mon Dec 5 15:35:36 2016 -0500

    Fix the error of adding a tag with the empty string when --output-tags argument is absent

diff --git a/sdk/cwl/arvados_cwl/__init__.py b/sdk/cwl/arvados_cwl/__init__.py
index cacb7b8..5078b63 100644
--- a/sdk/cwl/arvados_cwl/__init__.py
+++ b/sdk/cwl/arvados_cwl/__init__.py
@@ -262,12 +262,13 @@ class ArvCwlRunner(object):
                     final.api_response()["name"],
                     final.manifest_locator())
 
-        final_uuid = final.manifest_locator()
-        tags = tagsString.split(',')
-        for tag in tags:
-             self.api.links().create(body={
-                "head_uuid": final_uuid, "link_class": "tag", "name": tag
-                }).execute(num_retries=self.num_retries)
+        if tagsString is not None:
+            final_uuid = final.manifest_locator()
+            tags = tagsString.split(',')
+            for tag in tags:
+                 self.api.links().create(body={
+                    "head_uuid": final_uuid, "link_class": "tag", "name": tag
+                    }).execute(num_retries=self.num_retries)
 
         def finalcollection(fileobj):
             fileobj["location"] = "keep:%s/%s" % (final.portable_data_hash(), fileobj["location"])
@@ -449,8 +450,6 @@ class ArvCwlRunner(object):
         else:
             if self.output_name is None:
                 self.output_name = "Output of %s" % (shortname(tool.tool["id"]))
-            if self.output_tags is None:
-                self.output_tags = ""
             self.final_output, self.final_output_collection = self.make_output_collection(self.output_name, self.output_tags, self.final_output)
             self.set_crunch_output()
 
diff --git a/sdk/cwl/tests/test_make_output.py b/sdk/cwl/tests/test_make_output.py
index 53f379f..ebd85fe 100644
--- a/sdk/cwl/tests/test_make_output.py
+++ b/sdk/cwl/tests/test_make_output.py
@@ -71,3 +71,40 @@ class TestMakeOutput(unittest.TestCase):
         self.api.links().create.assert_has_calls([mock.call(body={"head_uuid": final_uuid, "link_class": "tag", "name": "tag0"}), mock.call().execute(num_retries=num_retries)])
         self.api.links().create.assert_has_calls([mock.call(body={"head_uuid": final_uuid, "link_class": "tag", "name": "tag1"}), mock.call().execute(num_retries=num_retries)])
         self.api.links().create.assert_has_calls([mock.call(body={"head_uuid": final_uuid, "link_class": "tag", "name": "tag2"}), mock.call().execute(num_retries=num_retries)])
+
+    @mock.patch("arvados.collection.Collection")
+    @mock.patch("arvados.collection.CollectionReader")
+    def test_make_output_collection_no_tags(self, reader, col):
+        keep_client = mock.MagicMock()
+        runner = arvados_cwl.ArvCwlRunner(self.api, keep_client=keep_client)
+        runner.project_uuid = 'zzzzz-j7d0g-zzzzzzzzzzzzzzz'
+
+        final = mock.MagicMock()
+        col.return_value = final
+        readermock = mock.MagicMock()
+        reader.return_value = readermock
+
+        final_uuid = final.manifest_locator()
+        num_retries = runner.num_retries
+
+        cwlout = StringIO.StringIO()
+        openmock = mock.MagicMock()
+        final.open.return_value = openmock
+        openmock.__enter__.return_value = cwlout
+
+        _, runner.final_output_collection = runner.make_output_collection("Test output", None, {
+            "foo": {
+                "class": "File",
+                "location": "keep:99999999999999999999999999999991+99/foo.txt",
+                "size": 3,
+                "basename": "foo.txt"
+            },
+            "bar": {
+                "class": "File",
+                "location": "keep:99999999999999999999999999999992+99/bar.txt",
+                "basename": "baz.txt",
+                "size": 4
+            }
+        })
+
+        self.api.links().create(body={"head_uuid": final_uuid, "link_class": "tag", "name": ""}).execute(num_retries=num_retries).assert_not_called()

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list