diff options
author | Arun Isaac | 2025-01-21 14:18:41 +0000 |
---|---|---|
committer | Arun Isaac | 2025-01-21 14:19:39 +0000 |
commit | 15065f4bb08c92100ff3e2cb159b9ed73612ee2c (patch) | |
tree | 061b391d8e78078420e57573fdb64cdadbbcda2f | |
parent | a24d749d31a6cf34237de4fc1e09f83bb346ffa9 (diff) | |
download | ravanan-15065f4bb08c92100ff3e2cb159b9ed73612ee2c.tar.gz ravanan-15065f4bb08c92100ff3e2cb159b9ed73612ee2c.tar.lz ravanan-15065f4bb08c92100ff3e2cb159b9ed73612ee2c.zip |
command-line-tool: Write output JSON atomically to the store.
* ravanan/command-line-tool.scm (run-command-line-tool,
build-command-line-tool-script): Write output JSON atomically to the
store.
-rw-r--r-- | ravanan/command-line-tool.scm | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/ravanan/command-line-tool.scm b/ravanan/command-line-tool.scm index a5b800f..a56241b 100644 --- a/ravanan/command-line-tool.scm +++ b/ravanan/command-line-tool.scm @@ -395,7 +395,6 @@ state-monadic job state object. @var{channels}, @var{scratch}, @var{store}, @var{batch-system} and @var{guix-daemon-socket} are the same as in @code{run-workflow} from @code{(ravanan workflow)}." - ;; TODO: Write to the store atomically. (let* ((script (build-command-line-tool-script name manifest-file channels cwl inputs scratch store batch-system @@ -481,7 +480,7 @@ state-monadic job state object. (output-json (call-with-input-file store-data-file json->scm))) ;; Recursively rewrite file paths in output JSON. - (call-with-output-file store-data-file + (call-with-atomic-output-file store-data-file (lambda (port) (scm->json (let rewrite ((tree output-json)) (cond @@ -767,7 +766,7 @@ same as in @code{run-workflow} from @code{(ravanan workflow)}." (define capture-outputs-gexp #~(let ((workflow-output-directory (getenv "WORKFLOW_OUTPUT_DIRECTORY"))) - (call-with-output-file (getenv "WORKFLOW_OUTPUT_DATA_FILE") + (call-with-atomic-output-file (getenv "WORKFLOW_OUTPUT_DATA_FILE") (lambda (out) (scm->json (if (file-exists? "cwl.output.json") |