[ARVADOS] updated: 5d563fd582659c81cbdd146d049c5c731ea9e742

Git user git at public.curoverse.com
Wed Jul 27 16:45:21 EDT 2016


Summary of changes:
 .../crunch-dispatch-slurm_test.go                  | 27 ++++++++++++++++++++++
 1 file changed, 27 insertions(+)

       via  5d563fd582659c81cbdd146d049c5c731ea9e742 (commit)
      from  2233f33d0f274e7226a4754e40c09738dfc72ca8 (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 5d563fd582659c81cbdd146d049c5c731ea9e742
Author: radhika <radhika at curoverse.com>
Date:   Wed Jul 27 16:25:06 2016 -0400

    9581: add sbatchFunc test

diff --git a/services/crunch-dispatch-slurm/crunch-dispatch-slurm_test.go b/services/crunch-dispatch-slurm/crunch-dispatch-slurm_test.go
index 2da1f70..163059a 100644
--- a/services/crunch-dispatch-slurm/crunch-dispatch-slurm_test.go
+++ b/services/crunch-dispatch-slurm/crunch-dispatch-slurm_test.go
@@ -10,6 +10,7 @@ import (
 	"io"
 	"io/ioutil"
 	"log"
+	"math"
 	"net/http"
 	"net/http/httptest"
 	"os"
@@ -290,3 +291,29 @@ func (s *MockArvadosServerSuite) TestReadConfig(c *C) {
 	c.Check(3, Equals, len(config.SbatchArguments))
 	c.Check(args, DeepEquals, config.SbatchArguments)
 }
+
+func (s *MockArvadosServerSuite) TestSbatchFuncWithConfigArgs(c *C) {
+	testSbatchFuncWithArgs(c, []string{"--arg1=v1", "--arg2"})
+}
+
+func (s *MockArvadosServerSuite) TestSbatchFuncWithNoConfigArgs(c *C) {
+	testSbatchFuncWithArgs(c, []string{})
+}
+
+func testSbatchFuncWithArgs(c *C, args []string) {
+	config.SbatchArguments = append(config.SbatchArguments, args...)
+
+	container := arvados.Container{UUID: "123", RuntimeConstraints: arvados.RuntimeConstraints{RAM: 1000000, VCPUs: 2}}
+	sbatchCmd := sbatchFunc(container)
+
+	var expected []string
+	expected = append(expected, "sbatch")
+	expected = append(expected, "--share")
+	expected = append(expected, config.SbatchArguments...)
+	expected = append(expected, fmt.Sprintf("--job-name=%s", container.UUID))
+	memPerCPU := math.Ceil(float64(container.RuntimeConstraints.RAM) / (float64(container.RuntimeConstraints.VCPUs) * 1048576))
+	expected = append(expected, fmt.Sprintf("--mem-per-cpu=%d", int(memPerCPU)))
+	expected = append(expected, fmt.Sprintf("--cpus-per-task=2"))
+
+	c.Check(sbatchCmd.Args, DeepEquals, expected)
+}

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list