diff options
author | Arun Isaac | 2024-09-20 17:19:22 +0100 |
---|---|---|
committer | Arun Isaac | 2024-09-23 23:50:50 +0100 |
commit | fcb98e428ea9967f8de0c953e2e400bb81d26c4f (patch) | |
tree | ef8dcc8be553d4577546f7f2841b48501ce9c40d | |
parent | 3ae913cd1e1bb46094f7ca2f4d41cb55dffe8856 (diff) | |
download | ravanan-fcb98e428ea9967f8de0c953e2e400bb81d26c4f.tar.gz ravanan-fcb98e428ea9967f8de0c953e2e400bb81d26c4f.tar.lz ravanan-fcb98e428ea9967f8de0c953e2e400bb81d26c4f.zip |
utils: Move json-ref to (ravanan work utils).
* ravanan/utils.scm: Move to ...
* ravanan/work/utils.scm (json-ref): ... here.
* ravanan/slurm-api.scm: Import (ravanan work utils) instead
of (ravanan utils).
-rw-r--r-- | ravanan/slurm-api.scm | 2 | ||||
-rw-r--r-- | ravanan/utils.scm | 10 | ||||
-rw-r--r-- | ravanan/work/utils.scm | 10 |
3 files changed, 11 insertions, 11 deletions
diff --git a/ravanan/slurm-api.scm b/ravanan/slurm-api.scm index 4ed02b5..fdc89fc 100644 --- a/ravanan/slurm-api.scm +++ b/ravanan/slurm-api.scm @@ -25,7 +25,7 @@ #:use-module (web client) #:use-module (web uri) #:use-module (json) - #:use-module (ravanan utils) + #:use-module (ravanan work utils) #:export (submit-job job-state)) diff --git a/ravanan/utils.scm b/ravanan/utils.scm index 5ae3c20..b2c3c94 100644 --- a/ravanan/utils.scm +++ b/ravanan/utils.scm @@ -21,7 +21,6 @@ #:use-module (srfi srfi-26) #:use-module (ice-9 match) #:export (string-trim-prefix - json-ref call-with-temporary-file)) (define (string-trim-prefix prefix str) @@ -30,15 +29,6 @@ (substring str (string-length prefix)) str)) -(define (json-ref scm . keys) - "Extract subtree of JSON @var{scm} that is addressed by @var{keys}." - (match keys - ((key other-keys ...) - (apply json-ref - ((if (list? scm) assoc-ref vector-ref) scm key) - other-keys)) - (() scm))) - (define* (call-with-temporary-file proc #:optional (parent-directory (getcwd))) "Call @var{proc} with an output port to a new temporary file in @var{parent-directory}, and delete it when @var{proc} returns or exits diff --git a/ravanan/work/utils.scm b/ravanan/work/utils.scm index 1323352..15349b2 100644 --- a/ravanan/work/utils.scm +++ b/ravanan/work/utils.scm @@ -27,6 +27,7 @@ alist=? assoc-ref* assoc-set + json-ref call-with-temporary-directory call-with-input-pipe)) @@ -62,6 +63,15 @@ mutated." tail)) (() alist))) +(define (json-ref scm . keys) + "Extract subtree of JSON @var{scm} that is addressed by @var{keys}." + (match keys + ((key other-keys ...) + (apply json-ref + ((if (list? scm) assoc-ref vector-ref) scm key) + other-keys)) + (() scm))) + (define* (call-with-temporary-directory proc #:optional (parent-directory (getcwd))) "Call @var{proc} with a new temporary directory in |