X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/fd178c88e1f61ca4e809073ee5baafa26986eb59..ba34a22d9918ae97306472c04701e69090821c82:/sdk/cwl/tests/test_container.py diff --git a/sdk/cwl/tests/test_container.py b/sdk/cwl/tests/test_container.py index cb57b446da..75371e2b78 100644 --- a/sdk/cwl/tests/test_container.py +++ b/sdk/cwl/tests/test_container.py @@ -186,7 +186,7 @@ class TestContainer(unittest.TestCase): 'command': ['ls', '/var/spool/cwl'], 'cwd': '/var/spool/cwl', 'scheduling_parameters': {}, - 'properties': {}, + 'properties': {'cwl_input': {}}, 'secret_mounts': {}, 'output_storage_classes': ["default"] })) @@ -201,6 +201,7 @@ class TestContainer(unittest.TestCase): runner.intermediate_output_ttl = 3600 runner.secret_store = cwltool.secrets.SecretStore() runner.api._rootDesc = {"revision": "20210628"} + runner.api.config.return_value = {"Containers": {"DefaultKeepCacheDisk": 0}} keepdocker.return_value = [("zzzzz-4zz18-zzzzzzzzzzzzzz3", "")] runner.api.collections().get().execute.return_value = { @@ -277,7 +278,7 @@ class TestContainer(unittest.TestCase): 'scheduling_parameters': { 'partitions': ['blurb'] }, - 'properties': {}, + 'properties': {'cwl_input': {}}, 'secret_mounts': {}, 'output_storage_classes': ["default"] } @@ -410,7 +411,7 @@ class TestContainer(unittest.TestCase): 'cwd': '/var/spool/cwl', 'scheduling_parameters': { }, - 'properties': {}, + 'properties': {'cwl_input': {}}, 'secret_mounts': {}, 'output_storage_classes': ["default"] } @@ -497,7 +498,7 @@ class TestContainer(unittest.TestCase): 'command': ['ls', '/var/spool/cwl'], 'cwd': '/var/spool/cwl', 'scheduling_parameters': {}, - 'properties': {}, + 'properties': {'cwl_input': {}}, 'secret_mounts': {}, 'output_storage_classes': ["default"] })) @@ -534,6 +535,7 @@ class TestContainer(unittest.TestCase): arvjob.successCodes = [0] arvjob.outdir = "/var/spool/cwl" arvjob.output_ttl = 3600 + arvjob.uuid = "zzzzz-xvhdp-zzzzzzzzzzzzzz1" arvjob.collect_outputs.return_value = {"out": "stuff"} @@ -543,7 +545,8 @@ class TestContainer(unittest.TestCase): "output_uuid": "zzzzz-4zz18-zzzzzzzzzzzzzz2", "uuid": "zzzzz-xvhdp-zzzzzzzzzzzzzzz", "container_uuid": "zzzzz-8i9sb-zzzzzzzzzzzzzzz", - "modified_at": "2017-05-26T12:01:22Z" + "modified_at": "2017-05-26T12:01:22Z", + "properties": {} }) self.assertFalse(api.collections().create.called) @@ -553,6 +556,10 @@ class TestContainer(unittest.TestCase): arvjob.output_callback.assert_called_with({"out": "stuff"}, "success") runner.add_intermediate_output.assert_called_with("zzzzz-4zz18-zzzzzzzzzzzzzz2") + runner.api.container_requests().update.assert_called_with(uuid="zzzzz-xvhdp-zzzzzzzzzzzzzz1", + body={'container_request': {'properties': {'cwl_output': {'out': 'stuff'}}}}) + + # Test to make sure we dont call runtime_status_update if we already did # some where higher up in the call stack @mock.patch("arvados_cwl.util.get_current_container") @@ -636,7 +643,8 @@ class TestContainer(unittest.TestCase): "output_uuid": "zzzzz-4zz18-zzzzzzzzzzzzzz2", "uuid": "zzzzz-xvhdp-zzzzzzzzzzzzzzz", "container_uuid": "zzzzz-8i9sb-zzzzzzzzzzzzzzz", - "modified_at": "2017-05-26T12:01:22Z" + "modified_at": "2017-05-26T12:01:22Z", + "properties": {} }) rts_mock.assert_called_with( @@ -733,7 +741,38 @@ class TestContainer(unittest.TestCase): 'command': ['ls', '/var/spool/cwl'], 'cwd': '/var/spool/cwl', 'scheduling_parameters': {}, - 'properties': {}, + 'properties': {'cwl_input': { + "p1": { + "basename": "99999999999999999999999999999994+44", + "class": "Directory", + "dirname": "/keep", + "http://arvados.org/cwl#collectionUUID": "zzzzz-4zz18-zzzzzzzzzzzzzzz", + "listing": [ + { + "basename": "file1", + "class": "File", + "dirname": "/keep/99999999999999999999999999999994+44", + "location": "keep:99999999999999999999999999999994+44/file1", + "nameext": "", + "nameroot": "file1", + "path": "/keep/99999999999999999999999999999994+44/file1", + "size": 0 + }, + { + "basename": "file2", + "class": "File", + "dirname": "/keep/99999999999999999999999999999994+44", + "location": "keep:99999999999999999999999999999994+44/file2", + "nameext": "", + "nameroot": "file2", + "path": "/keep/99999999999999999999999999999994+44/file2", + "size": 0 + } + ], + "location": "keep:99999999999999999999999999999994+44", + "path": "/keep/99999999999999999999999999999994+44" + } + }}, 'secret_mounts': {}, 'output_storage_classes': ["default"] })) @@ -827,7 +866,7 @@ class TestContainer(unittest.TestCase): 'command': ['md5sum', 'example.conf'], 'cwd': '/var/spool/cwl', 'scheduling_parameters': {}, - 'properties': {}, + 'properties': {'cwl_input': job_order}, "secret_mounts": { "/var/spool/cwl/example.conf": { "content": "username: user\npassword: blorp\n", @@ -949,7 +988,7 @@ class TestContainer(unittest.TestCase): 'command': ['ls', '/var/spool/cwl'], 'cwd': '/var/spool/cwl', 'scheduling_parameters': {}, - 'properties': {}, + 'properties': {'cwl_input': {}}, 'secret_mounts': {}, 'output_storage_classes': ["foo_sc", "bar_sc"] })) @@ -1037,6 +1076,7 @@ class TestContainer(unittest.TestCase): 'scheduling_parameters': {}, 'properties': { "baz": "blorp", + "cwl_input": {"x": "blorp"}, "foo": "bar", "quux": { "q1": 1, @@ -1145,7 +1185,7 @@ class TestContainer(unittest.TestCase): 'command': ['nvidia-smi'], 'cwd': '/var/spool/cwl', 'scheduling_parameters': {}, - 'properties': {}, + 'properties': {'cwl_input': {}}, 'secret_mounts': {}, 'output_storage_classes': ["default"] })) @@ -1219,7 +1259,7 @@ class TestContainer(unittest.TestCase): 'command': ['echo'], 'cwd': '/var/spool/cwl', 'scheduling_parameters': {}, - 'properties': {}, + 'properties': {'cwl_input': {}}, 'secret_mounts': {}, 'output_storage_classes': ["default"] } @@ -1332,7 +1372,7 @@ class TestContainer(unittest.TestCase): 'command': ['ls', '/var/spool/cwl'], 'cwd': '/var/spool/cwl', 'scheduling_parameters': sched, - 'properties': {}, + 'properties': {'cwl_input': {}}, 'secret_mounts': {}, 'output_storage_classes': ["default"] })) @@ -1521,7 +1561,19 @@ class TestWorkflow(unittest.TestCase): "output_path": "/var/spool/cwl", "output_ttl": 0, "priority": 500, - "properties": {}, + "properties": {'cwl_input': { + "fileblub": { + "basename": "token.txt", + "class": "File", + "dirname": "/keep/99999999999999999999999999999999+118", + "location": "keep:99999999999999999999999999999999+118/token.txt", + "nameext": ".txt", + "nameroot": "token", + "path": "/keep/99999999999999999999999999999999+118/token.txt", + "size": 0 + }, + "sleeptime": 5 + }}, "runtime_constraints": { "ram": 1073741824, "vcpus": 1 @@ -1594,7 +1646,7 @@ class TestWorkflow(unittest.TestCase): 'name': u'echo-subwf', 'secret_mounts': {}, 'runtime_constraints': {'API': True, 'vcpus': 3, 'ram': 1073741824}, - 'properties': {}, + 'properties': {'cwl_input': {}}, 'priority': 500, 'mounts': { '/var/spool/cwl/cwl.input.yml': {