[ARVADOS] updated: 93b12225ca665ec1869eea038aa516ec71c68ff4
git at public.curoverse.com
git at public.curoverse.com
Wed Jan 20 07:17:32 EST 2016
Summary of changes:
services/crunch-dispatch-local/crunch-dispatch-local.go | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
via 93b12225ca665ec1869eea038aa516ec71c68ff4 (commit)
from 62248e55fc084176bb42c19b45d968b068876feb (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 93b12225ca665ec1869eea038aa516ec71c68ff4
Author: radhika <radhika at curoverse.com>
Date: Wed Jan 20 07:16:05 2016 -0500
8028: when a signal is received, terminate all running commands and wait in a WaitGroup.
diff --git a/services/crunch-dispatch-local/crunch-dispatch-local.go b/services/crunch-dispatch-local/crunch-dispatch-local.go
index e575839..eb8550e 100644
--- a/services/crunch-dispatch-local/crunch-dispatch-local.go
+++ b/services/crunch-dispatch-local/crunch-dispatch-local.go
@@ -7,6 +7,7 @@ import (
"os"
"os/exec"
"os/signal"
+ "sync"
"syscall"
"time"
)
@@ -52,16 +53,22 @@ func doMain() error {
sigChan = make(chan os.Signal, 1)
signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT)
go func(sig <-chan os.Signal) {
+ var wg sync.WaitGroup
for sig := range sig {
doneProcessing <- true
caught := sig
for uuid, cmd := range runningCmds {
- cmd.Process.Signal(caught)
- if _, err := cmd.Process.Wait(); err != nil {
- log.Printf("Error while waiting for process to finish for %v: %q", uuid, err)
- }
+ go func(uuid string) {
+ wg.Add(1)
+ defer wg.Done()
+ cmd.Process.Signal(caught)
+ if _, err := cmd.Process.Wait(); err != nil {
+ log.Printf("Error while waiting for process to finish for %v: %q", uuid, err)
+ }
+ }(uuid)
}
}
+ wg.Wait()
}(sigChan)
// channel to terminate
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list