about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ravanan/command-line-tool.scm41
-rw-r--r--ravanan/store.scm62
-rw-r--r--ravanan/workflow.scm1
3 files changed, 64 insertions, 40 deletions
diff --git a/ravanan/command-line-tool.scm b/ravanan/command-line-tool.scm
index 958d99e..e82cf9f 100644
--- a/ravanan/command-line-tool.scm
+++ b/ravanan/command-line-tool.scm
@@ -45,6 +45,7 @@
   #:use-module (ravanan reader)
   #:use-module ((ravanan single-machine) #:prefix single-machine:)
   #:use-module ((ravanan slurm-api) #:prefix slurm:)
+  #:use-module (ravanan store)
   #:use-module (ravanan utils)
   #:use-module (ravanan work command-line-tool)
   #:use-module (ravanan work monads)
@@ -57,14 +58,8 @@
             inherit-requirements
             %command-line-tool-supported-requirements
             command-line-tool-supported-requirements
-            script->store-stdout-file
-            script->store-stderr-file
             capture-command-line-tool-output
 
-            %store-files-directory
-            %store-data-directory
-            %store-logs-directory
-
             manifest-file-error?
             manifest-file-error-file))
 
@@ -74,15 +69,6 @@
   manifest-file-error manifest-file-error?
   (file manifest-file-error-file))
 
-(define %store-files-directory
-  "files")
-
-(define %store-data-directory
-  "data")
-
-(define %store-logs-directory
-  "logs")
-
 (define %command-line-tool-supported-requirements
   (list "EnvVarRequirement"
         "InlineJavascriptRequirement"
@@ -361,31 +347,6 @@ When @var{guix-daemon-socket} is provided, connect to that Guix daemon."
               (built-derivations (list drv))
               (return (derivation->output-path drv))))))))
 
-(define (script->store-files-directory script store)
-  "Return the store files directory in @var{store} corresponding to @var{script}
-path."
-  (expand-file-name (file-name-join* %store-files-directory
-                                     (basename script))
-                    store))
-
-(define (script->store-data-file script store)
-  "Return the store data file in @var{store} corresponding to @var{script} path."
-  (expand-file-name (file-name-join* %store-data-directory
-                                     (string-append (basename script) ".json"))
-                    store))
-
-(define (script->store-stdout-file script store)
-  "Return the store stdout file in @var{store} corresponding to @var{script} path."
-  (expand-file-name (file-name-join* %store-logs-directory
-                                     (string-append (basename script) ".stdout"))
-                    store))
-
-(define (script->store-stderr-file script store)
-  "Return the store stderr file in @var{store} corresponding to @var{script} path."
-  (expand-file-name (file-name-join* %store-logs-directory
-                                     (string-append (basename script) ".stderr"))
-                    store))
-
 (define* (run-command-line-tool name manifest-file channels cwl inputs
                                 scratch store batch-system
                                 #:key guix-daemon-socket)
diff --git a/ravanan/store.scm b/ravanan/store.scm
new file mode 100644
index 0000000..ec2dedc
--- /dev/null
+++ b/ravanan/store.scm
@@ -0,0 +1,62 @@
+;;; ravanan --- High-reproducibility CWL runner powered by Guix
+;;; Copyright © 2025 Arun Isaac <arunisaac@systemreboot.net>
+;;;
+;;; This file is part of ravanan.
+;;;
+;;; ravanan is free software: you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation, either version 3 of the License, or
+;;; (at your option) any later version.
+;;;
+;;; ravanan is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;;; General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with ravanan.  If not, see <https://www.gnu.org/licenses/>.
+
+(define-module (ravanan store)
+  #:use-module (ice-9 filesystem)
+  #:export (%store-files-directory
+            %store-data-directory
+            %store-logs-directory
+
+            script->store-files-directory
+            script->store-data-file
+            script->store-stdout-file
+            script->store-stderr-file))
+
+(define %store-files-directory
+  "files")
+
+(define %store-data-directory
+  "data")
+
+(define %store-logs-directory
+  "logs")
+
+(define (script->store-files-directory script store)
+  "Return the store files directory in @var{store} corresponding to @var{script}
+path."
+  (expand-file-name (file-name-join* %store-files-directory
+                                     (basename script))
+                    store))
+
+(define (script->store-data-file script store)
+  "Return the store data file in @var{store} corresponding to @var{script} path."
+  (expand-file-name (file-name-join* %store-data-directory
+                                     (string-append (basename script) ".json"))
+                    store))
+
+(define (script->store-stdout-file script store)
+  "Return the store stdout file in @var{store} corresponding to @var{script} path."
+  (expand-file-name (file-name-join* %store-logs-directory
+                                     (string-append (basename script) ".stdout"))
+                    store))
+
+(define (script->store-stderr-file script store)
+  "Return the store stderr file in @var{store} corresponding to @var{script} path."
+  (expand-file-name (file-name-join* %store-logs-directory
+                                     (string-append (basename script) ".stderr"))
+                    store))
diff --git a/ravanan/workflow.scm b/ravanan/workflow.scm
index 282e299..bf0696e 100644
--- a/ravanan/workflow.scm
+++ b/ravanan/workflow.scm
@@ -31,6 +31,7 @@
   #:use-module (ravanan command-line-tool)
   #:use-module (ravanan job-state)
   #:use-module (ravanan propnet)
+  #:use-module (ravanan store)
   #:use-module (ravanan work command-line-tool)
   #:use-module (ravanan work monads)
   #:use-module (ravanan work types)