X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/341f5b9ee96921018d80145712bba1200f9ea1a3..98911cfe4792b20798858cefb353c451460e1a80:/sdk/cwl/tests/test_submit.py diff --git a/sdk/cwl/tests/test_submit.py b/sdk/cwl/tests/test_submit.py index 5ab452fdfc..77bef075fa 100644 --- a/sdk/cwl/tests/test_submit.py +++ b/sdk/cwl/tests/test_submit.py @@ -168,6 +168,7 @@ def stubs(func): } ]}}, 'cwl:tool': '3fffdeaa75e018172e1b583425f4ebff+60/workflow.cwl#main', + 'arv:debug': True, 'arv:enable_reuse': True, 'arv:on_error': 'continue' }, @@ -234,8 +235,10 @@ def stubs(func): 'secret_mounts': {}, 'state': 'Committed', 'owner_uuid': None, - 'command': ['arvados-cwl-runner', '--local', '--api=containers', '--no-log-timestamps', - '--enable-reuse', '--on-error=continue', '--eval-timeout=20', + 'command': ['arvados-cwl-runner', '--local', '--api=containers', + '--no-log-timestamps', '--disable-validate', + '--eval-timeout=20', '--thread-count=4', + '--enable-reuse', '--debug', '--on-error=continue', '/var/lib/cwl/workflow.json#main', '/var/lib/cwl/cwl.input.json'], 'name': 'submit_wf.cwl', 'container_image': 'arvados/jobs:'+arvados_cwl.__version__, @@ -443,7 +446,7 @@ class TestSubmit(unittest.TestCase): project_uuid = 'zzzzz-j7d0g-zzzzzzzzzzzzzzz' exited = arvados_cwl.main( - ["--submit", "--no-wait", + ["--submit", "--no-wait", "--debug", "--project-uuid", project_uuid, "tests/wf/submit_wf.cwl", "tests/submit_test_job.json"], sys.stdout, sys.stderr, api_client=stubs.api) @@ -500,8 +503,10 @@ class TestSubmit(unittest.TestCase): expect_container = copy.deepcopy(stubs.expect_container_spec) expect_container["command"] = [ - 'arvados-cwl-runner', '--local', '--api=containers', '--no-log-timestamps', - '--disable-reuse', '--on-error=continue', '--eval-timeout=20', + 'arvados-cwl-runner', '--local', '--api=containers', + '--no-log-timestamps', '--disable-validate', + '--eval-timeout=20', '--thread-count=4', + '--disable-reuse', '--debug', '--on-error=continue', '/var/lib/cwl/workflow.json#main', '/var/lib/cwl/cwl.input.json'] expect_container["use_existing"] = False @@ -523,8 +528,10 @@ class TestSubmit(unittest.TestCase): expect_container = copy.deepcopy(stubs.expect_container_spec) expect_container["command"] = [ - 'arvados-cwl-runner', '--local', '--api=containers', '--no-log-timestamps', - '--disable-reuse', '--on-error=continue', '--eval-timeout=20', + 'arvados-cwl-runner', '--local', '--api=containers', + '--no-log-timestamps', '--disable-validate', + '--eval-timeout=20', '--thread-count=4', + '--disable-reuse', '--debug', '--on-error=continue', '/var/lib/cwl/workflow.json#main', '/var/lib/cwl/cwl.input.json'] expect_container["use_existing"] = False expect_container["name"] = "submit_wf_no_reuse.cwl" @@ -558,9 +565,11 @@ class TestSubmit(unittest.TestCase): logging.exception("") expect_container = copy.deepcopy(stubs.expect_container_spec) - expect_container["command"] = ['arvados-cwl-runner', '--local', '--api=containers', '--no-log-timestamps', - '--enable-reuse', '--on-error=stop', '--eval-timeout=20', - '/var/lib/cwl/workflow.json#main', '/var/lib/cwl/cwl.input.json'] + expect_container["command"] = ['arvados-cwl-runner', '--local', '--api=containers', + '--no-log-timestamps', '--disable-validate', + '--eval-timeout=20', '--thread-count=4', + '--enable-reuse', '--debug', '--on-error=stop', + '/var/lib/cwl/workflow.json#main', '/var/lib/cwl/cwl.input.json'] stubs.api.container_requests().create.assert_called_with( body=JsonDiffMatcher(expect_container)) @@ -582,9 +591,12 @@ class TestSubmit(unittest.TestCase): logging.exception("") expect_container = copy.deepcopy(stubs.expect_container_spec) - expect_container["command"] = ['arvados-cwl-runner', '--local', '--api=containers', '--no-log-timestamps', - "--output-name="+output_name, '--enable-reuse', '--on-error=continue', '--eval-timeout=20', - '/var/lib/cwl/workflow.json#main', '/var/lib/cwl/cwl.input.json'] + expect_container["command"] = ['arvados-cwl-runner', '--local', '--api=containers', + '--no-log-timestamps', '--disable-validate', + '--eval-timeout=20', '--thread-count=4', + '--enable-reuse', + "--output-name="+output_name, '--debug', '--on-error=continue', + '/var/lib/cwl/workflow.json#main', '/var/lib/cwl/cwl.input.json'] expect_container["output_name"] = output_name stubs.api.container_requests().create.assert_called_with( @@ -606,9 +618,11 @@ class TestSubmit(unittest.TestCase): logging.exception("") expect_container = copy.deepcopy(stubs.expect_container_spec) - expect_container["command"] = ['arvados-cwl-runner', '--local', '--api=containers', '--no-log-timestamps', - '--enable-reuse', '--on-error=continue', - "--intermediate-output-ttl=3600", '--eval-timeout=20', + expect_container["command"] = ['arvados-cwl-runner', '--local', '--api=containers', + '--no-log-timestamps', '--disable-validate', + '--eval-timeout=20', '--thread-count=4', + '--enable-reuse', '--debug', '--on-error=continue', + "--intermediate-output-ttl=3600", '/var/lib/cwl/workflow.json#main', '/var/lib/cwl/cwl.input.json'] stubs.api.container_requests().create.assert_called_with( @@ -629,9 +643,11 @@ class TestSubmit(unittest.TestCase): logging.exception("") expect_container = copy.deepcopy(stubs.expect_container_spec) - expect_container["command"] = ['arvados-cwl-runner', '--local', '--api=containers', '--no-log-timestamps', - '--enable-reuse', '--on-error=continue', - "--trash-intermediate", '--eval-timeout=20', + expect_container["command"] = ['arvados-cwl-runner', '--local', '--api=containers', + '--no-log-timestamps', '--disable-validate', + '--eval-timeout=20', '--thread-count=4', + '--enable-reuse', '--debug', '--on-error=continue', + "--trash-intermediate", '/var/lib/cwl/workflow.json#main', '/var/lib/cwl/cwl.input.json'] stubs.api.container_requests().create.assert_called_with( @@ -654,9 +670,12 @@ class TestSubmit(unittest.TestCase): logging.exception("") expect_container = copy.deepcopy(stubs.expect_container_spec) - expect_container["command"] = ['arvados-cwl-runner', '--local', '--api=containers', '--no-log-timestamps', - "--output-tags="+output_tags, '--enable-reuse', '--on-error=continue', '--eval-timeout=20', - '/var/lib/cwl/workflow.json#main', '/var/lib/cwl/cwl.input.json'] + expect_container["command"] = ['arvados-cwl-runner', '--local', '--api=containers', + '--no-log-timestamps', '--disable-validate', + '--eval-timeout=20', '--thread-count=4', + '--enable-reuse', + "--output-tags="+output_tags, '--debug', '--on-error=continue', + '/var/lib/cwl/workflow.json#main', '/var/lib/cwl/cwl.input.json'] stubs.api.container_requests().create.assert_called_with( body=JsonDiffMatcher(expect_container)) @@ -736,8 +755,10 @@ class TestSubmit(unittest.TestCase): 'output_path': '/var/spool/cwl', 'name': 'expect_arvworkflow.cwl#main', 'container_image': 'arvados/jobs:'+arvados_cwl.__version__, - 'command': ['arvados-cwl-runner', '--local', '--api=containers', '--no-log-timestamps', - '--enable-reuse', '--on-error=continue', '--eval-timeout=20', + 'command': ['arvados-cwl-runner', '--local', '--api=containers', + '--no-log-timestamps', '--disable-validate', + '--eval-timeout=20', '--thread-count=4', + '--enable-reuse', '--debug', '--on-error=continue', '/var/lib/cwl/workflow/expect_arvworkflow.cwl#main', '/var/lib/cwl/cwl.input.json'], 'cwd': '/var/spool/cwl', 'runtime_constraints': { @@ -853,8 +874,10 @@ class TestSubmit(unittest.TestCase): 'output_path': '/var/spool/cwl', 'name': 'a test workflow', 'container_image': 'arvados/jobs:'+arvados_cwl.__version__, - 'command': ['arvados-cwl-runner', '--local', '--api=containers', '--no-log-timestamps', - '--enable-reuse', '--on-error=continue', '--eval-timeout=20', + 'command': ['arvados-cwl-runner', '--local', '--api=containers', + '--no-log-timestamps', '--disable-validate', + '--eval-timeout=20', '--thread-count=4', + '--enable-reuse', '--debug', '--on-error=continue', '/var/lib/cwl/workflow.json#main', '/var/lib/cwl/cwl.input.json'], 'cwd': '/var/spool/cwl', 'runtime_constraints': { @@ -911,8 +934,11 @@ class TestSubmit(unittest.TestCase): expect_container = copy.deepcopy(stubs.expect_container_spec) expect_container["owner_uuid"] = project_uuid - expect_container["command"] = ['arvados-cwl-runner', '--local', '--api=containers', '--no-log-timestamps', - '--enable-reuse', '--on-error=continue', '--project-uuid='+project_uuid, '--eval-timeout=20', + expect_container["command"] = ['arvados-cwl-runner', '--local', '--api=containers', + '--no-log-timestamps', '--disable-validate', + "--eval-timeout=20", "--thread-count=4", + '--enable-reuse', '--debug', '--on-error=continue', + '--project-uuid='+project_uuid, '/var/lib/cwl/workflow.json#main', '/var/lib/cwl/cwl.input.json'] stubs.api.container_requests().create.assert_called_with( @@ -934,8 +960,36 @@ class TestSubmit(unittest.TestCase): logging.exception("") expect_container = copy.deepcopy(stubs.expect_container_spec) - expect_container["command"] = ['arvados-cwl-runner', '--local', '--api=containers', '--no-log-timestamps', - '--enable-reuse', '--on-error=continue', '--eval-timeout=60.0', + expect_container["command"] = ['arvados-cwl-runner', '--local', '--api=containers', + '--no-log-timestamps', '--disable-validate', + '--eval-timeout=60.0', '--thread-count=4', + '--enable-reuse', '--debug', '--on-error=continue', + '/var/lib/cwl/workflow.json#main', '/var/lib/cwl/cwl.input.json'] + + stubs.api.container_requests().create.assert_called_with( + body=JsonDiffMatcher(expect_container)) + self.assertEqual(capture_stdout.getvalue(), + stubs.expect_container_request_uuid + '\n') + + + @stubs + def test_submit_container_thread_count(self, stubs): + project_uuid = 'zzzzz-j7d0g-zzzzzzzzzzzzzzz' + capture_stdout = cStringIO.StringIO() + try: + exited = arvados_cwl.main( + ["--submit", "--no-wait", "--api=containers", "--debug", "--thread-count=20", + "tests/wf/submit_wf.cwl", "tests/submit_test_job.json"], + capture_stdout, sys.stderr, api_client=stubs.api, keep_client=stubs.keep_client) + self.assertEqual(exited, 0) + except: + logging.exception("") + + expect_container = copy.deepcopy(stubs.expect_container_spec) + expect_container["command"] = ['arvados-cwl-runner', '--local', '--api=containers', + '--no-log-timestamps', '--disable-validate', + '--eval-timeout=20', '--thread-count=20', + '--enable-reuse', '--debug', '--on-error=continue', '/var/lib/cwl/workflow.json#main', '/var/lib/cwl/cwl.input.json'] stubs.api.container_requests().create.assert_called_with( @@ -1056,9 +1110,12 @@ class TestSubmit(unittest.TestCase): "--local", "--api=containers", "--no-log-timestamps", + "--disable-validate", + "--eval-timeout=20", + '--thread-count=4', "--enable-reuse", + '--debug', "--on-error=continue", - "--eval-timeout=20", "/var/lib/cwl/workflow.json#main", "/var/lib/cwl/cwl.input.json" ], @@ -1106,6 +1163,7 @@ class TestSubmit(unittest.TestCase): "type": "stdout" } ], + "stdout": "hashed_example.txt", "requirements": [ { "class": "InitialWorkDirRequirement",