aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ravanan/workflow.scm37
1 files changed, 18 insertions, 19 deletions
diff --git a/ravanan/workflow.scm b/ravanan/workflow.scm
index d3f2c7b..37df7ff 100644
--- a/ravanan/workflow.scm
+++ b/ravanan/workflow.scm
@@ -218,6 +218,21 @@ endpoint to connect to. @var{slurm-jwt}, a string, is the JWT token to
authenticate to the slurm API with. @var{slurm-api-endpoint} and
@var{slurm-jwt} are only used when @var{batch-system} is
@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)))))
+
(let ((cell-values
(run-propnet
(propnet (workflow->propagators name cwl)
@@ -229,22 +244,6 @@ authenticate to the slurm API with. @var{slurm-api-endpoint} and
#:slurm-api-endpoint slurm-api-endpoint
#:slurm-jwt slurm-jwt))
inputs)))
- (let ((class (assoc-ref* cwl "class")))
- (cond
- ((string=? class "CommandLineTool")
- (vector-map->list (lambda (output)
- (let ((output-id (assoc-ref output "id")))
- (cons output-id
- (or (assoc-ref cell-values output-id)
- (error "output not found" output-id)))))
- (assoc-ref cwl "outputs")))
- ((string=? class "ExpressionTool")
- (error "Workflow class not implemented yet" class))
- ((string=? class "Workflow")
- (vector-map->list (lambda (output)
- (let ((output-id (assoc-ref output "id")))
- (cons output-id
- (or (assoc-ref cell-values
- (assoc-ref* output "outputSource"))
- (error "output not found" output-id)))))
- (assoc-ref cwl "outputs")))))))
+ ;; Capture outputs.
+ (vector-map->list (cut capture-output cell-values <>)
+ (assoc-ref* cwl "outputs"))))