[ARVADOS] updated: 68b6917bd994ac608fa70f160643a070b7ead159

Git user git at public.curoverse.com
Wed Mar 9 14:40:35 EST 2016


Summary of changes:
 sdk/cwl/arvados_cwl/__init__.py | 22 ++++++++++++++--------
 sdk/cwl/tests/test_job.py       | 19 ++++++++++++++-----
 2 files changed, 28 insertions(+), 13 deletions(-)

       via  68b6917bd994ac608fa70f160643a070b7ead159 (commit)
      from  60b10d07802263e1f141dc52b96e0fb9623e5417 (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 68b6917bd994ac608fa70f160643a070b7ead159
Author: radhika <radhika at curoverse.com>
Date:   Wed Mar 9 14:39:58 2016 -0500

    8558: update field names and ensure the tests pass

diff --git a/sdk/cwl/arvados_cwl/__init__.py b/sdk/cwl/arvados_cwl/__init__.py
index 0f69ff6..d9f71a6 100644
--- a/sdk/cwl/arvados_cwl/__init__.py
+++ b/sdk/cwl/arvados_cwl/__init__.py
@@ -154,22 +154,28 @@ class ArvadosJob(object):
 
         resources = self.builder.resources
         if resources is not None:
-            keys = resources.keys()
-            if "coresMin" in keys:
+            if "cores" in resources:
                 try:
-                    runtime_constraints["min_cores_per_node"] = int(resources["coresMin"])
+                    runtime_constraints["min_cores_per_node"] = int(resources["cores"])
                 except:
                     runtime_constraints["min_cores_per_node"] = None
-            if "ramMin" in keys:
+            if "ram" in resources:
                 try:
-                    runtime_constraints["min_ram_mb_per_node"] = int(resources["ramMin"])
+                    runtime_constraints["min_ram_mb_per_node"] = int(resources["ram"])
                 except:
                     runtime_constraints["min_ram_mb_per_node"] = None
-            if "tmpdirMin" in keys:
+            if "tmpdirSize" in resources or "outdirSize" in resources:
+                tmpdirMin = None
                 try:
-                    runtime_constraints["min_scratch_mb_per_node"] = int(resources["tmpdirMin"])
+                    tmpdirMin = int(resources["tmpdirSize"])
                 except:
-                    runtime_constraints["min_scratch_mb_per_node"] = None
+                    tmpdirMin = 0
+                outdirMin = None
+                try:
+                    outdirMin = int(resources["outdirSize"])
+                except:
+                    outdirMin = 0
+                runtime_constraints["min_scratch_mb_per_node"] = tmpdirMin + outdirMin
 
         try:
             response = self.arvrunner.api.jobs().create(body={
diff --git a/sdk/cwl/tests/test_job.py b/sdk/cwl/tests/test_job.py
index 27a1916..9a1f9ec 100644
--- a/sdk/cwl/tests/test_job.py
+++ b/sdk/cwl/tests/test_job.py
@@ -3,6 +3,9 @@ import mock
 import arvados_cwl
 
 class TestJob(unittest.TestCase):
+
+    # The test passes no builder.resources
+    # Hence the default resources will apply: {'cores': 1, 'ram': 1024, 'outdirSize': 1024, 'tmpdirSize': 1024}
     def test_run(self):
         runner = mock.MagicMock()
         tool = {
@@ -26,10 +29,16 @@ class TestJob(unittest.TestCase):
             'script_version':
             'master',
             'repository': 'arvados',
-            'script': 'crunchrunner'
+            'script': 'crunchrunner',
+            'runtime_constraints': {
+                'min_cores_per_node': 1,
+                'min_ram_mb_per_node': 1024,
+                'min_scratch_mb_per_node': 2048 # tmpdirSize + outdirSize
+            }
         }, find_or_create=True)
 
-
+    # The test passes some fields in builder.resources
+    # For the remaining fields, the defaults will apply: {'cores': 1, 'ram': 1024, 'outdirSize': 1024, 'tmpdirSize': 1024}
     def test_resource_requirements(self):
         runner = mock.MagicMock()
         tool = {
@@ -37,9 +46,9 @@ class TestJob(unittest.TestCase):
             "outputs": [],
             "hints": [{
                 "class": "ResourceRequirement",
-                "minCores": 3,
+                "coresMin": 3,
                 "ramMin": 3000,
-                "tmpDirMin": 4000
+                "tmpdirMin": 4000
             }],
             "baseCommand": "ls"
         }
@@ -63,6 +72,6 @@ class TestJob(unittest.TestCase):
             'runtime_constraints': {
                 'min_cores_per_node': 3,
                 'min_ram_mb_per_node': 3000,
-                'min_scratch_mb_per_node': 4000
+                'min_scratch_mb_per_node': 5024 # tmpdirSize + outdirSize
             }
         }, find_or_create=True)

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list