aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2024-09-05 18:30:40 +0100
committerArun Isaac2024-09-05 23:35:11 +0100
commit8501b0319236c4e1c6223df7db3995507c830f48 (patch)
tree7728652b13771202852383d61bad311816a9d113
parent0776a3aa4d7b9a65d785ca7c30f423cb23fca330 (diff)
downloadravanan-8501b0319236c4e1c6223df7db3995507c830f48.tar.gz
ravanan-8501b0319236c4e1c6223df7db3995507c830f48.tar.lz
ravanan-8501b0319236c4e1c6223df7db3995507c830f48.zip
workflow: Do not error out on optional outputs.
* ravanan/workflow.scm (run-workflow)[capture-output]: Do not error out on optional outputs (that is, of the null type).
-rw-r--r--ravanan/workflow.scm36
1 files changed, 22 insertions, 14 deletions
diff --git a/ravanan/workflow.scm b/ravanan/workflow.scm
index 37df7ff..6764269 100644
--- a/ravanan/workflow.scm
+++ b/ravanan/workflow.scm
@@ -220,18 +220,26 @@ authenticate to the slurm API with. @var{slurm-api-endpoint} and
@code{'slurm-api}."
(define (capture-output cell-values output)
(let ((output-id (assoc-ref output "id")))
- (cons output-id
- (or (let ((class (assoc-ref* cwl "class")))
- (cond
- ((string=? class "CommandLineTool")
- (assoc-ref cell-values output-id))
- ((string=? class "ExpressionTool")
- (error "Workflow class not implemented yet"
- class))
- ((string=? class "Workflow")
- (assoc-ref cell-values
- (assoc-ref* output "outputSource")))))
- (error "output not found" output-id)))))
+ (cond
+ ;; The output is present; cons and return it.
+ ((let ((class (assoc-ref* cwl "class")))
+ (cond
+ ((string=? class "CommandLineTool")
+ (assoc-ref cell-values output-id))
+ ((string=? class "ExpressionTool")
+ (error "Workflow class not implemented yet"
+ class))
+ ((string=? class "Workflow")
+ (assoc-ref cell-values
+ (assoc-ref* output "outputSource")))))
+ => (cut cons output-id <>))
+ ;; The output is absent; check if a null type is acceptable.
+ ((match-type 'null
+ (formal-parameter-type (assoc-ref* output "type")))
+ #f)
+ ;; Else, error out.
+ (else
+ (error "output not found" output-id)))))
(let ((cell-values
(run-propnet
@@ -245,5 +253,5 @@ authenticate to the slurm API with. @var{slurm-api-endpoint} and
#:slurm-jwt slurm-jwt))
inputs)))
;; Capture outputs.
- (vector-map->list (cut capture-output cell-values <>)
- (assoc-ref* cwl "outputs"))))
+ (vector-filter-map->list (cut capture-output cell-values <>)
+ (assoc-ref* cwl "outputs"))))