Change visit in pathmapper.py to raise OSError if input file is not found, change...
authorJiayong Li <jiayong@math.mit.edu>
Fri, 26 May 2017 01:47:59 +0000 (21:47 -0400)
committerJiayong Li <jiayong@math.mit.edu>
Fri, 26 May 2017 01:47:59 +0000 (21:47 -0400)
sdk/cwl/arvados_cwl/pathmapper.py
sdk/cwl/setup.py
sdk/cwl/tests/test_pathmapper.py

index 52a65ff580b72e91349499815116d716829032b1..1ab8e831f4c43019b8097eeb24d9b85ca7ab6500 100644 (file)
@@ -61,7 +61,8 @@ class ArvPathMapper(PathMapper):
                 ab = abspath(src, self.input_basedir)
                 st = arvados.commands.run.statfile("", ab,
                                                    fnPattern="keep:%s/%s",
-                                                   dirPattern="keep:%s/%s")
+                                                   dirPattern="keep:%s/%s",
+                                                   raiseOSError=True)
                 with SourceLine(srcobj, "location", WorkflowException):
                     if isinstance(st, arvados.commands.run.UploadFile):
                         uploadfiles.add((src, ab, st))
index 38f1505a88752ad10cbb33a753fe767e0a5691b3..02c612fa905c50504a2dce7874708cd87050b0ba 100644 (file)
@@ -52,7 +52,7 @@ setup(name='arvados-cwl-runner',
           'schema-salad==2.5.20170428142041',
           'typing==3.5.3.0',
           'ruamel.yaml==0.13.7',
-          'arvados-python-client>=0.1.20170523195205',
+          'arvados-python-client>=0.1.20170526013812',
           'setuptools'
       ],
       data_files=[
index 7ba96497d8537101cc8ca38369c46a81d2cfab1e..86c48f2ddd1d3a2feb1b2f26562fac4c114f90a0 100644 (file)
@@ -101,3 +101,16 @@ class TestPathmap(unittest.TestCase):
 
         self.assertEqual({'file:tests/hw.py': MapperEnt(resolved='keep:99999999999999999999999999999991+99/hw.py', target='/test/99999999999999999999999999999991+99/hw.py', type='File', staged=True)},
                          p._pathmap)
+
+    @mock.patch("os.stat")
+    def test_missing_file(self, stat):
+        """Test pathmapper handling missing references."""
+        arvrunner = arvados_cwl.ArvCwlRunner(self.api)
+
+        stat.side_effect = OSError(2, "No such file or directory")
+
+        with self.assertRaises(OSError):
+            p = ArvPathMapper(arvrunner, [{
+                "class": "File",
+                "location": "file:tests/hw.py"
+            }], "", "/test/%s", "/test/%s/%s")