9187: Check LockedByUUID on container updates and terminate status updates if
[arvados.git] / services / crunch-dispatch-local / crunch-dispatch-local.go
index cc472a40311adc36f91202512c3f4f7fb52e2b8f..73a389533679a2ceef773a237891921ae5bf92fc 100644 (file)
@@ -159,7 +159,8 @@ func run(dispatcher *dispatch.Dispatcher,
        if err != nil {
                log.Printf("Error getting final container state: %v", err)
        }
-       if container.State != dispatch.Complete && container.State != dispatch.Cancelled {
+       if container.LockedByUUID == dispatcher.Auth.UUID &&
+               (container.State == dispatch.Locked || container.State == dispatch.Running) {
                log.Printf("After %s process termination, container state for %v is %q.  Updating it to %q",
                        *crunchRunCommand, container.State, uuid, dispatch.Cancelled)
                dispatcher.UpdateState(uuid, dispatch.Cancelled)