From 8501b0319236c4e1c6223df7db3995507c830f48 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Thu, 5 Sep 2024 18:30:40 +0100 Subject: 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). --- ravanan/workflow.scm | 36 ++++++++++++++++++++++-------------- 1 file 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")))) -- cgit v1.2.3