[ARVADOS] updated: 5385f033338aed928bc8c530e6f637056f76c474
git at public.curoverse.com
git at public.curoverse.com
Tue Jan 19 12:18:29 EST 2016
Summary of changes:
services/crunch-dispatch-local/crunch-dispatch-local.go | 11 +++++------
services/crunch-dispatch-local/crunch-dispatch-local_test.go | 7 +++++--
2 files changed, 10 insertions(+), 8 deletions(-)
via 5385f033338aed928bc8c530e6f637056f76c474 (commit)
from d3781de388530d06379974601247a6c044eee92e (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 5385f033338aed928bc8c530e6f637056f76c474
Author: radhika <radhika at curoverse.com>
Date: Tue Jan 19 12:16:51 2016 -0500
8028: After getting list of Queued containers, instead of looking for containers.ItemsAvailable, look for len(containers.Items)
diff --git a/services/crunch-dispatch-local/crunch-dispatch-local.go b/services/crunch-dispatch-local/crunch-dispatch-local.go
index 9fb4cb9..2b7bd24 100644
--- a/services/crunch-dispatch-local/crunch-dispatch-local.go
+++ b/services/crunch-dispatch-local/crunch-dispatch-local.go
@@ -84,8 +84,7 @@ type Container struct {
// ContainerList is a list of the containers from api
type ContainerList struct {
- ItemsAvailable int `json:"items_available"`
- Items []Container `json:"items"`
+ Items []Container `json:"items"`
}
// Get the list of queued containers from API server and invoke run for each container.
@@ -101,7 +100,7 @@ func dispatchLocal(priorityPollInterval int, crunchRunCommand string) {
return
}
- for i := 0; i < containers.ItemsAvailable; i++ {
+ for i := 0; i < len(containers.Items); i++ {
log.Printf("About to run queued container %v", containers.Items[i].UUID)
go run(containers.Items[i].UUID, crunchRunCommand, priorityPollInterval)
}
@@ -113,7 +112,7 @@ func dispatchLocal(priorityPollInterval int, crunchRunCommand string) {
// Set the container state to Running
// If the container priority becomes zero while crunch job is still running, terminate it.
func run(uuid string, crunchRunCommand string, priorityPollInterval int) {
- cmd := exec.Command(crunchRunCommand, "--job", uuid)
+ cmd := exec.Command(crunchRunCommand, uuid)
cmd.Stdin = nil
cmd.Stderr = os.Stderr
@@ -146,7 +145,7 @@ func run(uuid string, crunchRunCommand string, priorityPollInterval int) {
} else {
if container.Priority == 0 {
priorityTicker.Stop()
- cmd.Process.Kill()
+ cmd.Process.Signal(os.Interrupt)
return
}
}
@@ -168,7 +167,7 @@ func run(uuid string, crunchRunCommand string, priorityPollInterval int) {
err = arv.Update("containers", uuid,
arvadosclient.Dict{
"container": arvadosclient.Dict{"state": "Complete"}},
- &container)
+ nil)
if err != nil {
log.Printf("Error updating container state to Complete for %v: %q", uuid, err)
}
diff --git a/services/crunch-dispatch-local/crunch-dispatch-local_test.go b/services/crunch-dispatch-local/crunch-dispatch-local_test.go
index 1d526b9..997c63a 100644
--- a/services/crunch-dispatch-local/crunch-dispatch-local_test.go
+++ b/services/crunch-dispatch-local/crunch-dispatch-local_test.go
@@ -59,7 +59,7 @@ func (s *MockArvadosServerSuite) TearDownTest(c *C) {
}
func (s *TestSuite) Test_doMain(c *C) {
- args := []string{"-poll-interval", "1", "-container-priority-poll-interval", "1", "-crunch-run-command", "echo"}
+ args := []string{"-poll-interval", "2", "-container-priority-poll-interval", "1", "-crunch-run-command", "echo"}
os.Args = append(os.Args, args...)
go func() {
@@ -70,6 +70,9 @@ func (s *TestSuite) Test_doMain(c *C) {
err := doMain()
c.Check(err, IsNil)
+ // Give some time for run goroutine to complete
+ time.Sleep(1 * time.Second)
+
// There should be no queued containers now
params := arvadosclient.Dict{
"filters": [][]string{[]string{"state", "=", "Queued"}},
@@ -77,7 +80,7 @@ func (s *TestSuite) Test_doMain(c *C) {
var containers ContainerList
err = arv.List("containers", params, &containers)
c.Check(err, IsNil)
- c.Assert(containers.ItemsAvailable, Equals, 0)
+ c.Assert(len(containers.Items), Equals, 0)
// Previously "Queued" container should now be in "Complete" state
var container Container
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list