[ARVADOS] created: 86170c2f8a914c9cad72631964a189f7f61843b3

Git user git at public.curoverse.com
Mon Jun 13 16:23:09 EDT 2016


        at  86170c2f8a914c9cad72631964a189f7f61843b3 (commit)


commit 86170c2f8a914c9cad72631964a189f7f61843b3
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Mon Jun 13 16:22:46 2016 -0400

    8442: Introduce a RuntimeConstraints struct instead of using a map

diff --git a/sdk/go/dispatch/dispatch.go b/sdk/go/dispatch/dispatch.go
index 54d596f..c0e4f14 100644
--- a/sdk/go/dispatch/dispatch.go
+++ b/sdk/go/dispatch/dispatch.go
@@ -31,13 +31,19 @@ type apiClientAuthorizationList struct {
 	Items []apiClientAuthorization `json:"items"`
 }
 
+type RuntimeConstraints struct {
+	API   *bool `json:"API"`
+	Ram   int64 `json:"ram"`
+	Vcpus int64 `json:"vcpus"`
+}
+
 // Represents an Arvados container record
 type Container struct {
-	UUID               string           `json:"uuid"`
-	State              string           `json:"state"`
-	Priority           int              `json:"priority"`
-	RuntimeConstraints map[string]int64 `json:"runtime_constraints"`
-	LockedByUUID       string           `json:"locked_by_uuid"`
+	UUID               string             `json:"uuid"`
+	State              string             `json:"state"`
+	Priority           int                `json:"priority"`
+	RuntimeConstraints RuntimeConstraints `json:"runtime_constraints"`
+	LockedByUUID       string             `json:"locked_by_uuid"`
 }
 
 // ContainerList is a list of the containers from api
diff --git a/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go b/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go
index f718fbc..9b2cf0c 100644
--- a/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go
+++ b/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go
@@ -70,11 +70,11 @@ func doMain() error {
 
 // sbatchCmd
 func sbatchFunc(container dispatch.Container) *exec.Cmd {
-	memPerCPU := math.Ceil((float64(container.RuntimeConstraints["ram"])) / (float64(container.RuntimeConstraints["vcpus"] * 1048576)))
+	memPerCPU := math.Ceil((float64(container.RuntimeConstraints.Ram)) / (float64(container.RuntimeConstraints.Vcpus * 1048576)))
 	return exec.Command("sbatch", "--share", "--parsable",
 		fmt.Sprintf("--job-name=%s", container.UUID),
 		fmt.Sprintf("--mem-per-cpu=%d", int(memPerCPU)),
-		fmt.Sprintf("--cpus-per-task=%d", int(container.RuntimeConstraints["vcpus"])),
+		fmt.Sprintf("--cpus-per-task=%d", int(container.RuntimeConstraints.Vcpus)),
 		fmt.Sprintf("--priority=%d", container.Priority))
 }
 

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list