projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch '15421-include-param-doc' closes #15421
[arvados.git]
/
lib
/
dispatchcloud
/
test
/
queue.go
diff --git
a/lib/dispatchcloud/test/queue.go
b/lib/dispatchcloud/test/queue.go
index e18a2b5362b413a16eeb28984bfabbe34796f6db..6a6c952358bcadff447d08869e641f32d24618ad 100644
(file)
--- a/
lib/dispatchcloud/test/queue.go
+++ b/
lib/dispatchcloud/test/queue.go
@@
-158,14
+158,21
@@
func (q *Queue) Update() error {
//
// The resulting changes are not exposed through Get() or Entries()
// until the next call to Update().
//
// The resulting changes are not exposed through Get() or Entries()
// until the next call to Update().
-func (q *Queue) Notify(upd arvados.Container) {
+//
+// Return value is true unless the update is rejected (invalid state
+// transition).
+func (q *Queue) Notify(upd arvados.Container) bool {
q.mtx.Lock()
defer q.mtx.Unlock()
for i, ctr := range q.Containers {
if ctr.UUID == upd.UUID {
q.mtx.Lock()
defer q.mtx.Unlock()
for i, ctr := range q.Containers {
if ctr.UUID == upd.UUID {
- q.Containers[i] = upd
- return
+ if ctr.State != arvados.ContainerStateComplete && ctr.State != arvados.ContainerStateCancelled {
+ q.Containers[i] = upd
+ return true
+ }
+ return false
}
}
q.Containers = append(q.Containers, upd)
}
}
q.Containers = append(q.Containers, upd)
+ return true
}
}