diff options
-rw-r--r-- | ravanan/command-line-tool.scm | 17 | ||||
-rw-r--r-- | ravanan/single-machine.scm | 27 |
2 files changed, 24 insertions, 20 deletions
diff --git a/ravanan/command-line-tool.scm b/ravanan/command-line-tool.scm index acab4af..7da91e3 100644 --- a/ravanan/command-line-tool.scm +++ b/ravanan/command-line-tool.scm @@ -441,14 +441,15 @@ path." (cond ((eq? batch-system 'single-machine) (single-machine-job-state script - (single-machine:submit-job - `(("WORKFLOW_OUTPUT_DIRECTORY" . - ,store-files-directory) - ("WORKFLOW_OUTPUT_DATA_FILE" . - ,store-data-file)) - stdout-file - stderr-file - script))) + (run-with-state + (single-machine:submit-job + `(("WORKFLOW_OUTPUT_DIRECTORY" . + ,store-files-directory) + ("WORKFLOW_OUTPUT_DATA_FILE" . + ,store-data-file)) + stdout-file + stderr-file + script)))) ((slurm-api-batch-system? batch-system) (format (current-error-port) "Submitting job ~a~%" diff --git a/ravanan/single-machine.scm b/ravanan/single-machine.scm index eb7131f..854dd2c 100644 --- a/ravanan/single-machine.scm +++ b/ravanan/single-machine.scm @@ -19,6 +19,7 @@ (define-module (ravanan single-machine) #:use-module (srfi srfi-26) #:use-module (ice-9 match) + #:use-module (ravanan work monads) #:export (submit-job)) (define (submit-job environment stdout-file stderr-file script) @@ -26,15 +27,17 @@ @var{environment} is an association list of environment variables to set in the job. @var{stdout-file} and @var{stderr-file} are files in which to write the stdout and stderr of the job respectively. Return @code{#t} if job succeeded, -else @code{#f}." - (for-each (match-lambda - ((name . value) - (setenv name value))) - environment) - (format (current-error-port) - "Running ~a~%" - script) - (zero? (with-output-to-file stdout-file - (lambda () - (with-error-to-file stderr-file - (cut system* script)))))) +else @code{#f}. The return value is state-monadic." + (state-return + (begin + (for-each (match-lambda + ((name . value) + (setenv name value))) + environment) + (format (current-error-port) + "Running ~a~%" + script) + (zero? (with-output-to-file stdout-file + (lambda () + (with-error-to-file stderr-file + (cut system* script)))))))) |