[ARVADOS] created: 2bfa9d382f95b3cf444f901ded84595a68b80c6a
Git user
git at public.curoverse.com
Tue May 2 23:13:08 EDT 2017
at 2bfa9d382f95b3cf444f901ded84595a68b80c6a (commit)
commit 2bfa9d382f95b3cf444f901ded84595a68b80c6a
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Tue May 2 23:06:28 2017 -0400
11369: Containers API: Add capacity to tmp and output mounts. Also support {outputDirType: keep_output_dir} of RuntimeConstraints.
diff --git a/sdk/cwl/arvados_cwl/arvcontainer.py b/sdk/cwl/arvados_cwl/arvcontainer.py
index 657d592..0b302b6 100644
--- a/sdk/cwl/arvados_cwl/arvcontainer.py
+++ b/sdk/cwl/arvados_cwl/arvcontainer.py
@@ -45,12 +45,20 @@ class ArvadosContainer(object):
"properties": {}
}
runtime_constraints = {}
+
+ resources = self.builder.resources
+ if resources is not None:
+ runtime_constraints["vcpus"] = resources.get("cores", 1)
+ runtime_constraints["ram"] = resources.get("ram") * 2**20
+
mounts = {
self.outdir: {
- "kind": "tmp"
+ "kind": "tmp",
+ "capacity": resources.get("outdirSize", 0) * 2**20
},
self.tmpdir: {
- "kind": "tmp"
+ "kind": "tmp",
+ "capacity": resources.get("tmpdirSize", 0) * 2**20
}
}
scheduling_parameters = {}
@@ -139,11 +147,6 @@ class ArvadosContainer(object):
pull_image,
self.arvrunner.project_uuid)
- resources = self.builder.resources
- if resources is not None:
- runtime_constraints["vcpus"] = resources.get("cores", 1)
- runtime_constraints["ram"] = resources.get("ram") * 2**20
-
api_req, _ = get_feature(self, "http://arvados.org/cwl#APIRequirement")
if api_req:
runtime_constraints["API"] = True
@@ -152,6 +155,15 @@ class ArvadosContainer(object):
if runtime_req:
if "keep_cache" in runtime_req:
runtime_constraints["keep_cache_ram"] = runtime_req["keep_cache"] * 2**20
+ if "outputDirType" in runtime_req:
+ if runtime_req["outputDirType"] == "local_output_dir":
+ # Currently the default behavior.
+ pass
+ elif runtime_req["outputDirType"] == "keep_output_dir":
+ mounts[self.outdir]= {
+ "kind": "collection",
+ "writable": True
+ }
partition_req, _ = get_feature(self, "http://arvados.org/cwl#PartitionRequirement")
if partition_req:
diff --git a/sdk/cwl/tests/test_container.py b/sdk/cwl/tests/test_container.py
index b06eae8..af05773 100644
--- a/sdk/cwl/tests/test_container.py
+++ b/sdk/cwl/tests/test_container.py
@@ -63,8 +63,11 @@ class TestContainer(unittest.TestCase):
'use_existing': enable_reuse,
'priority': 1,
'mounts': {
- '/tmp': {'kind': 'tmp'},
- '/var/spool/cwl': {'kind': 'tmp'}
+ '/tmp': {'kind': 'tmp',
+ "capacity": 1073741824
+ },
+ '/var/spool/cwl': {'kind': 'tmp',
+ "capacity": 1073741824 }
},
'state': 'Committed',
'owner_uuid': 'zzzzz-8i9sb-zzzzzzzzzzzzzzz',
@@ -97,7 +100,8 @@ class TestContainer(unittest.TestCase):
"class": "ResourceRequirement",
"coresMin": 3,
"ramMin": 3000,
- "tmpdirMin": 4000
+ "tmpdirMin": 4000,
+ "outdirMin": 5000
}, {
"class": "http://arvados.org/cwl#RuntimeConstraints",
"keep_cache": 512
@@ -136,8 +140,10 @@ class TestContainer(unittest.TestCase):
'use_existing': True,
'priority': 1,
'mounts': {
- '/tmp': {'kind': 'tmp'},
- '/var/spool/cwl': {'kind': 'tmp'}
+ '/tmp': {'kind': 'tmp',
+ "capacity": 4194304000 },
+ '/var/spool/cwl': {'kind': 'tmp',
+ "capacity": 5242880000 }
},
'state': 'Committed',
'owner_uuid': 'zzzzz-8i9sb-zzzzzzzzzzzzzzz',
@@ -242,8 +248,10 @@ class TestContainer(unittest.TestCase):
'use_existing': True,
'priority': 1,
'mounts': {
- '/tmp': {'kind': 'tmp'},
- '/var/spool/cwl': {'kind': 'tmp'},
+ '/tmp': {'kind': 'tmp',
+ "capacity": 1073741824 },
+ '/var/spool/cwl': {'kind': 'tmp',
+ "capacity": 1073741824 },
'/var/spool/cwl/foo': {
'kind': 'collection',
'path': 'foo',
@@ -328,8 +336,10 @@ class TestContainer(unittest.TestCase):
'use_existing': True,
'priority': 1,
'mounts': {
- '/tmp': {'kind': 'tmp'},
- '/var/spool/cwl': {'kind': 'tmp'},
+ '/tmp': {'kind': 'tmp',
+ "capacity": 1073741824 },
+ '/var/spool/cwl': {'kind': 'tmp',
+ "capacity": 1073741824 },
"stderr": {
"kind": "file",
"path": "/var/spool/cwl/stderr.txt"
@@ -460,8 +470,10 @@ class TestContainer(unittest.TestCase):
"kind": "collection",
"portable_data_hash": "99999999999999999999999999999994+44"
},
- '/tmp': {'kind': 'tmp'},
- '/var/spool/cwl': {'kind': 'tmp'}
+ '/tmp': {'kind': 'tmp',
+ "capacity": 1073741824 },
+ '/var/spool/cwl': {'kind': 'tmp',
+ "capacity": 1073741824 }
},
'state': 'Committed',
'owner_uuid': 'zzzzz-8i9sb-zzzzzzzzzzzzzzz',
commit 10441f4b9de13a1f9e1dc6c0f025b26d2d25ab10
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Tue May 2 22:53:28 2017 -0400
11369: Fix tests. Tweak test fixture to include a mounts entry with capacity.
diff --git a/services/api/test/fixtures/containers.yml b/services/api/test/fixtures/containers.yml
index d1f4c7b..863309d 100644
--- a/services/api/test/fixtures/containers.yml
+++ b/services/api/test/fixtures/containers.yml
@@ -12,6 +12,10 @@ queued:
runtime_constraints:
ram: 12000000000
vcpus: 4
+ mounts:
+ /tmp:
+ kind: tmp
+ capacity: 24000000000
running:
uuid: zzzzz-dz642-runningcontainr
diff --git a/services/crunch-dispatch-slurm/crunch-dispatch-slurm_test.go b/services/crunch-dispatch-slurm/crunch-dispatch-slurm_test.go
index e6abb16..e1e8c79 100644
--- a/services/crunch-dispatch-slurm/crunch-dispatch-slurm_test.go
+++ b/services/crunch-dispatch-slurm/crunch-dispatch-slurm_test.go
@@ -118,10 +118,11 @@ func (s *TestSuite) TestIntegrationCancel(c *C) {
}
func (s *TestSuite) TestIntegrationMissingFromSqueue(c *C) {
- container := s.integrationTest(c, func() *exec.Cmd { return exec.Command("echo") }, []string{"sbatch", "--share",
+ container := s.integrationTest(c, func() *exec.Cmd { return exec.Command("echo") }, []string{"sbatch",
fmt.Sprintf("--job-name=%s", "zzzzz-dz642-queuedcontainer"),
- fmt.Sprintf("--mem-per-cpu=%d", 2862),
- fmt.Sprintf("--cpus-per-task=%d", 4)},
+ fmt.Sprintf("--mem=%d", 11445),
+ fmt.Sprintf("--cpus-per-task=%d", 4),
+ fmt.Sprintf("--tmp=%d", 22889)},
func(dispatcher *dispatch.Dispatcher, container arvados.Container) {
dispatcher.UpdateState(container.UUID, dispatch.Running)
time.Sleep(3 * time.Second)
@@ -327,9 +328,9 @@ func testSbatchFuncWithArgs(c *C, args []string) {
sbatchCmd := sbatchFunc(container)
var expected []string
- expected = append(expected, "sbatch", "--share")
+ expected = append(expected, "sbatch")
expected = append(expected, theConfig.SbatchArguments...)
- expected = append(expected, "--job-name=123", "--mem-per-cpu=120", "--cpus-per-task=2")
+ expected = append(expected, "--job-name=123", "--mem=239", "--cpus-per-task=2", "--tmp=0")
c.Check(sbatchCmd.Args, DeepEquals, expected)
}
@@ -340,8 +341,8 @@ func (s *MockArvadosServerSuite) TestSbatchPartition(c *C) {
sbatchCmd := sbatchFunc(container)
var expected []string
- expected = append(expected, "sbatch", "--share")
- expected = append(expected, "--job-name=123", "--mem-per-cpu=239", "--cpus-per-task=1", "--partition=blurb,b2")
+ expected = append(expected, "sbatch")
+ expected = append(expected, "--job-name=123", "--mem=239", "--cpus-per-task=1", "--tmp=0", "--partition=blurb,b2")
c.Check(sbatchCmd.Args, DeepEquals, expected)
}
commit 9350a0562776be66a099dce1c3e825b32f5a8907
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Tue May 2 22:21:36 2017 -0400
11369: RAM request includes keep cache RAM. Add request for temp disk.
diff --git a/sdk/go/arvados/container.go b/sdk/go/arvados/container.go
index 36d9af1..d59a57c 100644
--- a/sdk/go/arvados/container.go
+++ b/sdk/go/arvados/container.go
@@ -27,6 +27,7 @@ type Mount struct {
Path string `json:"path"`
Content interface{} `json:"content"`
ExcludeFromOutput bool `json:"exclude_from_output"`
+ Capacity int64 `json:capacity`
}
// RuntimeConstraints specify a container's compute resources (RAM,
diff --git a/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go b/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go
index d84d461..71852bf 100644
--- a/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go
+++ b/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go
@@ -149,14 +149,20 @@ func checkSqueueForOrphans(dispatcher *dispatch.Dispatcher, sqCheck *SqueueCheck
// sbatchCmd
func sbatchFunc(container arvados.Container) *exec.Cmd {
- memPerCPU := math.Ceil(float64(container.RuntimeConstraints.RAM) / (float64(container.RuntimeConstraints.VCPUs) * 1048576))
+ mem := int64(math.Ceil(float64(container.RuntimeConstraints.RAM+container.RuntimeConstraints.KeepCacheRAM) / float64(1048576)))
+
+ var disk int64
+ for _, m := range container.Mounts {
+ disk += m.Capacity
+ }
+ disk = int64(math.Ceil(float64(disk) / float64(1048576)))
var sbatchArgs []string
- sbatchArgs = append(sbatchArgs, "--share")
sbatchArgs = append(sbatchArgs, theConfig.SbatchArguments...)
sbatchArgs = append(sbatchArgs, fmt.Sprintf("--job-name=%s", container.UUID))
- sbatchArgs = append(sbatchArgs, fmt.Sprintf("--mem-per-cpu=%d", int(memPerCPU)))
+ sbatchArgs = append(sbatchArgs, fmt.Sprintf("--mem=%d", mem))
sbatchArgs = append(sbatchArgs, fmt.Sprintf("--cpus-per-task=%d", container.RuntimeConstraints.VCPUs))
+ sbatchArgs = append(sbatchArgs, fmt.Sprintf("--tmp=%d", disk))
if len(container.SchedulingParameters.Partitions) > 0 {
sbatchArgs = append(sbatchArgs, fmt.Sprintf("--partition=%s", strings.Join(container.SchedulingParameters.Partitions, ",")))
}
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list