[ARVADOS] updated: 60b10d07802263e1f141dc52b96e0fb9623e5417

Git user git at public.curoverse.com
Tue Mar 8 10:11:39 EST 2016


Summary of changes:
 sdk/cwl/arvados_cwl/__init__.py                    |  2 +-
 sdk/cwl/setup.py                                   |  2 +
 .../cwl/tests/__init__.py                          |  0
 sdk/cwl/tests/test_job.py                          | 68 ++++++++++++++++++++++
 4 files changed, 71 insertions(+), 1 deletion(-)
 copy apps/workbench/app/views/application/_breadcrumb_page_name.html.erb => sdk/cwl/tests/__init__.py (100%)
 create mode 100644 sdk/cwl/tests/test_job.py

       via  60b10d07802263e1f141dc52b96e0fb9623e5417 (commit)
      from  67f5a1a4d8dde5bac538e7e8d102ca83dc3335d0 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 60b10d07802263e1f141dc52b96e0fb9623e5417
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Tue Mar 8 10:10:32 2016 -0500

    8558: Add test case for running ArvadosCommandTool

diff --git a/sdk/cwl/arvados_cwl/__init__.py b/sdk/cwl/arvados_cwl/__init__.py
index e3a5480..0f69ff6 100644
--- a/sdk/cwl/arvados_cwl/__init__.py
+++ b/sdk/cwl/arvados_cwl/__init__.py
@@ -175,7 +175,7 @@ class ArvadosJob(object):
             response = self.arvrunner.api.jobs().create(body={
                 "script": "crunchrunner",
                 "repository": "arvados",
-                "script_version": "8488-cwl-crunchrunner-collection",
+                "script_version": "master",
                 "script_parameters": {"tasks": [script_parameters], "crunchrunner": crunchrunner_pdh+"/crunchrunner"},
                 "runtime_constraints": runtime_constraints
             }, find_or_create=kwargs.get("enable_reuse", True)).execute(num_retries=self.arvrunner.num_retries)
diff --git a/sdk/cwl/setup.py b/sdk/cwl/setup.py
index cdbb41b..b85f3b4 100644
--- a/sdk/cwl/setup.py
+++ b/sdk/cwl/setup.py
@@ -33,6 +33,8 @@ setup(name='arvados-cwl-runner',
           'cwltool>=1.0.20160302134341',
           'arvados-python-client>=0.1.20160219154918'
       ],
+      test_suite='tests',
+      tests_require=['mock>=1.0'],
       zip_safe=True,
       cmdclass={'egg_info': tagger},
       )
diff --git a/sdk/cwl/tests/__init__.py b/sdk/cwl/tests/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/sdk/cwl/tests/__init__.py
@@ -0,0 +1 @@
+
diff --git a/sdk/cwl/tests/test_job.py b/sdk/cwl/tests/test_job.py
new file mode 100644
index 0000000..27a1916
--- /dev/null
+++ b/sdk/cwl/tests/test_job.py
@@ -0,0 +1,68 @@
+import unittest
+import mock
+import arvados_cwl
+
+class TestJob(unittest.TestCase):
+    def test_run(self):
+        runner = mock.MagicMock()
+        tool = {
+            "inputs": [],
+            "outputs": [],
+            "baseCommand": "ls"
+        }
+        arvtool = arvados_cwl.ArvadosCommandTool(runner, tool)
+        arvtool.formatgraph = None
+        for j in arvtool.job({}, "", mock.MagicMock()):
+            j.run()
+        runner.api.jobs().create.assert_called_with(body={
+            'runtime_constraints': {},
+            'script_parameters': {
+                'tasks': [{
+                    'task.env': {'TMPDIR': '$(task.tmpdir)'},
+                    'command': ['ls']
+                }],
+                'crunchrunner': '83db29f08544e1c319572a6bd971088a+140/crunchrunner'
+            },
+            'script_version':
+            'master',
+            'repository': 'arvados',
+            'script': 'crunchrunner'
+        }, find_or_create=True)
+
+
+    def test_resource_requirements(self):
+        runner = mock.MagicMock()
+        tool = {
+            "inputs": [],
+            "outputs": [],
+            "hints": [{
+                "class": "ResourceRequirement",
+                "minCores": 3,
+                "ramMin": 3000,
+                "tmpDirMin": 4000
+            }],
+            "baseCommand": "ls"
+        }
+        arvtool = arvados_cwl.ArvadosCommandTool(runner, tool)
+        arvtool.formatgraph = None
+        for j in arvtool.job({}, "", mock.MagicMock()):
+            j.run()
+        runner.api.jobs().create.assert_called_with(body={
+            'runtime_constraints': {},
+            'script_parameters': {
+                'tasks': [{
+                    'task.env': {'TMPDIR': '$(task.tmpdir)'},
+                    'command': ['ls']
+                }],
+                'crunchrunner': '83db29f08544e1c319572a6bd971088a+140/crunchrunner'
+            },
+            'script_version':
+            'master',
+            'repository': 'arvados',
+            'script': 'crunchrunner',
+            'runtime_constraints': {
+                'min_cores_per_node': 3,
+                'min_ram_mb_per_node': 3000,
+                'min_scratch_mb_per_node': 4000
+            }
+        }, find_or_create=True)

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list