[ARVADOS] created: 2.1.0-301-g3cb8be1e3

Git user git at public.arvados.org
Fri Jan 29 21:02:40 UTC 2021


        at  3cb8be1e32a1b2e477501c38cefa4c48bbbb8c29 (commit)


commit 3cb8be1e32a1b2e477501c38cefa4c48bbbb8c29
Author: Peter Amstutz <peter.amstutz at curii.com>
Date:   Fri Jan 29 15:54:41 2021 -0500

    17293: Update trash_at/deleted_at even on MarshalManifest error
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>

diff --git a/lib/crunchrun/crunchrun.go b/lib/crunchrun/crunchrun.go
index 730185c19..6e7e6feba 100644
--- a/lib/crunchrun/crunchrun.go
+++ b/lib/crunchrun/crunchrun.go
@@ -1431,15 +1431,20 @@ func (runner *ContainerRunner) saveLogCollection(final bool) (response arvados.C
 		// Already finalized.
 		return
 	}
-	mt, err := runner.LogCollection.MarshalManifest(".")
-	if err != nil {
-		err = fmt.Errorf("error creating log manifest: %v", err)
-		return
-	}
 	updates := arvadosclient.Dict{
-		"name":          "logs for " + runner.Container.UUID,
-		"manifest_text": mt,
+		"name": "logs for " + runner.Container.UUID,
 	}
+	mt, err1 := runner.LogCollection.MarshalManifest(".")
+	if err1 == nil {
+		// Only send updated manifest text if there was no
+		// error.
+		updates["manifest_text"] = mt
+	}
+
+	// Even if flushing the manifest had an error, we still want
+	// to update the log record, if possible, to push the trash_at
+	// and delete_at times into the future.  Details on bug
+	// #17293.
 	if final {
 		updates["is_trashed"] = true
 	} else {
@@ -1448,16 +1453,20 @@ func (runner *ContainerRunner) saveLogCollection(final bool) (response arvados.C
 		updates["delete_at"] = exp
 	}
 	reqBody := arvadosclient.Dict{"collection": updates}
+	var err2 error
 	if runner.logUUID == "" {
 		reqBody["ensure_unique_name"] = true
-		err = runner.DispatcherArvClient.Create("collections", reqBody, &response)
+		err2 = runner.DispatcherArvClient.Create("collections", reqBody, &response)
 	} else {
-		err = runner.DispatcherArvClient.Update("collections", runner.logUUID, reqBody, &response)
+		err2 = runner.DispatcherArvClient.Update("collections", runner.logUUID, reqBody, &response)
 	}
-	if err != nil {
-		return
+	if err2 == nil {
+		runner.logUUID = response.UUID
+	}
+
+	if err1 != nil || err2 != nil {
+		err = fmt.Errorf("error recording logs: %q, %q", err1, err2)
 	}
-	runner.logUUID = response.UUID
 	return
 }
 

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list