10221: Don't depend on st.keepref from arvados.commands.run.statfile and uploadfile...
authorPeter Amstutz <peter.amstutz@curoverse.com>
Wed, 12 Oct 2016 15:51:03 +0000 (11:51 -0400)
committerPeter Amstutz <peter.amstutz@curoverse.com>
Thu, 13 Oct 2016 12:15:04 +0000 (08:15 -0400)
sdk/cwl/arvados_cwl/pathmapper.py
sdk/cwl/tests/test_pathmapper.py

index 288397a5012ed39f339d276e27e8a708324064f8..73c81ceb0fcdb033203c1b7e5425b3875ea121d6 100644 (file)
@@ -37,11 +37,11 @@ class ArvPathMapper(PathMapper):
                 # Local FS ref, may need to be uploaded or may be on keep
                 # mount.
                 ab = abspath(src, self.input_basedir)
-                st = arvados.commands.run.statfile("", ab, fnPattern=self.file_pattern)
+                st = arvados.commands.run.statfile("", ab, fnPattern="keep:%s/%s")
                 if isinstance(st, arvados.commands.run.UploadFile):
                     uploadfiles.add((src, ab, st))
                 elif isinstance(st, arvados.commands.run.ArvFile):
-                    self._pathmap[src] = MapperEnt("keep:"+st.keepref, st.fn, "File")
+                    self._pathmap[src] = MapperEnt(st.fn, self.collection_pattern % st.fn[5:], "File")
                 elif src.startswith("_:"):
                     if "contents" in srcobj:
                         pass
@@ -91,12 +91,12 @@ class ArvPathMapper(PathMapper):
                                              self.arvrunner.api,
                                              dry_run=False,
                                              num_retries=self.arvrunner.num_retries,
-                                             fnPattern=self.file_pattern,
+                                             fnPattern="keep:%s/%s",
                                              name=self.name,
                                              project=self.arvrunner.project_uuid)
 
         for src, ab, st in uploadfiles:
-            self._pathmap[src] = MapperEnt("keep:" + st.keepref, st.fn, "File")
+            self._pathmap[src] = MapperEnt(st.fn, self.collection_pattern % st.fn[5:], "File")
             self.arvrunner.add_uploaded(src, self._pathmap[src])
 
         for srcobj in referenced_files:
index 065904daec0fc87267573927d7d9f98fed2c3ff7..7e13066d855a92e292420c229ba4c34f8e324e00 100644 (file)
@@ -18,9 +18,7 @@ from arvados_cwl.pathmapper import ArvPathMapper
 def upload_mock(files, api, dry_run=False, num_retries=0, project=None, fnPattern="$(file %s/%s)", name=None):
     pdh = "99999999999999999999999999999991+99"
     for c in files:
-        c.fn = os.path.basename(c.fn)
-        c.keepref = "%s/%s" % (pdh, c.fn)
-        c.fn = fnPattern % (pdh, c.fn)
+        c.fn = fnPattern % (pdh, os.path.basename(c.fn))
 
 class TestPathmap(unittest.TestCase):
     def test_keepref(self):
@@ -79,7 +77,6 @@ class TestPathmap(unittest.TestCase):
         # keep mount, so we can construct a direct reference directly without upload.
         def statfile_mock(prefix, fn, fnPattern="$(file %s/%s)", dirPattern="$(dir %s/%s/)"):
             st = arvados.commands.run.ArvFile("", fnPattern % ("99999999999999999999999999999991+99", "hw.py"))
-            st.keepref = "99999999999999999999999999999991+99/hw.py"
             return st
 
         upl.side_effect = upload_mock