[ARVADOS] updated: 67afdf7bd1d53164e91e38e3b3a801ae83da778d
Git user
git at public.curoverse.com
Fri Sep 2 11:43:15 EDT 2016
Summary of changes:
sdk/go/dispatch/dispatch.go | 15 +++++++++++++++
services/crunch-dispatch-slurm/crunch-dispatch-slurm.go | 5 +----
2 files changed, 16 insertions(+), 4 deletions(-)
via 67afdf7bd1d53164e91e38e3b3a801ae83da778d (commit)
from 716fc68b444bb4d43ecad56bcb90e9ebf4bda854 (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 67afdf7bd1d53164e91e38e3b3a801ae83da778d
Author: radhika <radhika at curoverse.com>
Date: Fri Sep 2 11:42:35 2016 -0400
9898: update crunch-dispatch to use lock and unlock apis instead of setting state directly.
diff --git a/sdk/go/dispatch/dispatch.go b/sdk/go/dispatch/dispatch.go
index ce536de..53f41d2 100644
--- a/sdk/go/dispatch/dispatch.go
+++ b/sdk/go/dispatch/dispatch.go
@@ -193,6 +193,21 @@ func (dispatcher *Dispatcher) handleUpdate(container arvados.Container) {
// UpdateState makes an API call to change the state of a container.
func (dispatcher *Dispatcher) UpdateState(uuid string, newState arvados.ContainerState) error {
+ if newState == Locked {
+ err := dispatcher.Arv.Call("POST", "containers", uuid, "lock", nil, nil)
+ if err != nil {
+ log.Printf("Error locking container %s: %q", uuid, err)
+ }
+ return err
+ } else if newState == Queued {
+ err := dispatcher.Arv.Call("POST", "containers", uuid, "unlock", nil, nil)
+ if err != nil {
+ log.Printf("Error unlocking container %s: %q", uuid, err)
+ }
+ return err
+ }
+
+ // All other states
err := dispatcher.Arv.Update("containers", uuid,
arvadosclient.Dict{
"container": arvadosclient.Dict{"state": newState}},
diff --git a/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go b/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go
index ef08f45..fa77e70 100644
--- a/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go
+++ b/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go
@@ -151,10 +151,7 @@ func submit(dispatcher *dispatch.Dispatcher,
// OK, no cleanup needed
return
}
- err := dispatcher.Arv.Update("containers", container.UUID,
- arvadosclient.Dict{
- "container": arvadosclient.Dict{"state": "Queued"}},
- nil)
+ err := dispatcher.UpdateState(container.UUID, dispatch.Queued)
if err != nil {
log.Printf("Error unlocking container %s: %v", container.UUID, err)
}
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list