19886: Save log collection when crunch-run starts a container
[arvados.git] / lib / crunchrun / crunchrun.go
index 52e1bf63a57037bc5a6184b88908bf5d6dcf6503..d322a3ac3c03f1eb178b9b2e6919de20cf30a390 100644 (file)
@@ -1434,7 +1434,11 @@ func (runner *ContainerRunner) UpdateContainerRunning() error {
                return ErrCancelled
        }
        return runner.DispatcherArvClient.Update("containers", runner.Container.UUID,
-               arvadosclient.Dict{"container": arvadosclient.Dict{"state": "Running", "gateway_address": runner.gateway.Address}}, nil)
+               arvadosclient.Dict{"container": arvadosclient.Dict{
+                       "state":           "Running",
+                       "gateway_address": runner.gateway.Address,
+                       "log":             runner.logUUID,
+               }}, nil)
 }
 
 // ContainerToken returns the api_token the container (and any
@@ -1625,6 +1629,10 @@ func (runner *ContainerRunner) Run() (err error) {
                return
        }
 
+       _, err = runner.saveLogCollection(false)
+       if err != nil {
+               runner.CrunchLog.Printf("Error committing initial log collection: %v", err)
+       }
        err = runner.UpdateContainerRunning()
        if err != nil {
                return