[ARVADOS] updated: 1.3.0-532-gc04d16f14
Git user
git at public.curoverse.com
Mon Mar 18 19:09:50 UTC 2019
Summary of changes:
lib/dispatchcloud/test/stub_driver.go | 38 +++++++++++++++++++----------------
1 file changed, 21 insertions(+), 17 deletions(-)
via c04d16f1482d10d64ddcceba4dcc7ab06032f033 (commit)
from cd020c016106fbe844501c5f434c16f4def4e08d (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 c04d16f1482d10d64ddcceba4dcc7ab06032f033
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date: Mon Mar 18 15:08:19 2019 -0400
14807: Lengthen kill delays in stub driver to test term-kill-drain.
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>
diff --git a/lib/dispatchcloud/test/stub_driver.go b/lib/dispatchcloud/test/stub_driver.go
index 28fee6d92..a4521eab7 100644
--- a/lib/dispatchcloud/test/stub_driver.go
+++ b/lib/dispatchcloud/test/stub_driver.go
@@ -126,6 +126,8 @@ func (sis *StubInstanceSet) Create(it arvados.InstanceType, image cloud.ImageID,
tags: copyTags(tags),
providerType: it.ProviderType,
initCommand: cmd,
+ running: map[string]int64{},
+ killing: map[string]bool{},
}
svm.SSHService = SSHService{
HostKey: sis.driver.HostKey,
@@ -192,6 +194,7 @@ type StubVM struct {
providerType string
SSHService SSHService
running map[string]int64
+ killing map[string]bool
lastPID int64
sync.Mutex
}
@@ -248,9 +251,6 @@ func (svm *StubVM) Exec(env map[string]string, command string, stdin io.Reader,
svm.Lock()
svm.lastPID++
pid := svm.lastPID
- if svm.running == nil {
- svm.running = map[string]int64{}
- }
svm.running[uuid] = pid
svm.Unlock()
time.Sleep(svm.CrunchRunDetachDelay)
@@ -319,21 +319,25 @@ func (svm *StubVM) Exec(env map[string]string, command string, stdin io.Reader,
if strings.HasPrefix(command, "crunch-run --kill ") {
svm.Lock()
pid, running := svm.running[uuid]
- svm.Unlock()
- go func() {
- time.Sleep(time.Duration(math_rand.Float64()*20) * time.Millisecond)
+ if running && !svm.killing[uuid] {
+ svm.killing[uuid] = true
+ go func() {
+ time.Sleep(time.Duration(math_rand.Float64()*30) * time.Millisecond)
+ svm.Lock()
+ defer svm.Unlock()
+ if svm.running[uuid] == pid {
+ // Kill only if the running entry
+ // hasn't since been killed and
+ // replaced with a different one.
+ delete(svm.running, uuid)
+ }
+ delete(svm.killing, uuid)
+ }()
+ svm.Unlock()
+ time.Sleep(time.Duration(math_rand.Float64()*2) * time.Millisecond)
svm.Lock()
- defer svm.Unlock()
- if svm.running[uuid] == pid {
- // Kill only if the running entry
- // hasn't since been killed and
- // replaced with a different one.
- delete(svm.running, uuid)
- }
- }()
- time.Sleep(time.Duration(math_rand.Float64()*2) * time.Millisecond)
- svm.Lock()
- _, running = svm.running[uuid]
+ _, running = svm.running[uuid]
+ }
svm.Unlock()
if running {
fmt.Fprintf(stderr, "%s: container is running\n", uuid)
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list