From 4455ff16e346765ddcbe5bec7aa5b1b50a01c06f Mon Sep 17 00:00:00 2001 From: Tom Clegg Date: Mon, 6 Apr 2020 10:57:08 -0400 Subject: [PATCH] Exit non-zero if container is cancelled. Arvados-DCO-1.1-Signed-off-by: Tom Clegg --- arvados.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arvados.go b/arvados.go index cc4a10c0d7..ca967824b5 100644 --- a/arvados.go +++ b/arvados.go @@ -257,7 +257,7 @@ func (runner *arvadosContainerRunner) Run() (string, error) { return } if lastState != cr.State { - log.Printf("container state: %s", cr.State) + log.Printf("container request state: %s", cr.State) lastState = cr.State } if subscribedUUID != cr.ContainerUUID { @@ -291,8 +291,9 @@ func (runner *arvadosContainerRunner) Run() (string, error) { err = runner.Client.RequestAndDecode(&c, "GET", "arvados/v1/containers/"+cr.ContainerUUID, nil, nil) if err != nil { return "", err - } - if c.ExitCode != 0 { + } else if c.State != arvados.ContainerStateComplete { + return "", fmt.Errorf("container did not complete: %s", c.State) + } else if c.ExitCode != 0 { return "", fmt.Errorf("container exited %d", c.ExitCode) } return cr.OutputUUID, err -- 2.30.2