aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2025-01-24 23:37:16 +0000
committerArun Isaac2025-01-24 23:42:54 +0000
commitf342f12292c25ba3f67fe9f60955a5b81b075ea5 (patch)
tree961048a1a011be35e740797366fa786461e03d33
parent394c89a39435bb4a11517e223130d899bbd5d59c (diff)
downloadravanan-f342f12292c25ba3f67fe9f60955a5b81b075ea5.tar.gz
ravanan-f342f12292c25ba3f67fe9f60955a5b81b075ea5.tar.lz
ravanan-f342f12292c25ba3f67fe9f60955a5b81b075ea5.zip
slurm-api: Translate slurm job states correctly.
The job states returned by the slurm API are not the same as that expected by ravanan code. * ravanan/slurm-api.scm (job-state): Translate PENDING and RUNNING to pending state. Translate SUCCESS to completed state.
-rw-r--r--ravanan/slurm-api.scm18
1 files changed, 13 insertions, 5 deletions
diff --git a/ravanan/slurm-api.scm b/ravanan/slurm-api.scm
index 81a9fc9..beb93d0 100644
--- a/ravanan/slurm-api.scm
+++ b/ravanan/slurm-api.scm
@@ -139,7 +139,14 @@ monad."
(#(job-state)
(trace 'slurm-api
"slurmctld reports ~a state for job ~a" job-state job-id)
- (let ((job-state (string->symbol (string-downcase job-state))))
+ (let ((job-state
+ (case (string->symbol (string-downcase job-state))
+ ;; slurm returns a PENDING state when the job has not yet
+ ;; been scheduled on a compute node, and RUNNING once it
+ ;; has been scheduled and is running.
+ ((pending running) 'pending)
+ ((completed) 'completed)
+ (else (error "Unknown slurm job state" job-state)))))
(trace 'slurm-api
"return ~a state for job ~a" job-state job-id)
job-state)))))
@@ -179,10 +186,11 @@ monad."
"slurmdbd reports ~a state for job ~a"
job-state job-id)
;; job-state is either "SUCCESS" or "ERROR".
- (let ((job-state (if (eq? (string->symbol (string-downcase job-state))
- 'success)
- 'success
- 'failed)))
+ (let ((job-state
+ (case (string->symbol (string-downcase job-state))
+ ((success) 'completed)
+ ((error) 'failed)
+ (else (error "Unknown slurm job state" job-state)))))
(trace 'slurm-api
"return ~a state for job ~a" job-state job-id)
job-state))))))