summaryrefslogtreecommitdiff
path: root/ccwl
diff options
context:
space:
mode:
authorArun Isaac2021-06-01 14:04:59 +0530
committerArun Isaac2021-06-01 14:04:59 +0530
commit0d3e584d03131aae13aeaedfb2451d673b6d91f7 (patch)
treec25291560a00e98e8c774c029583b7934cdf3557 /ccwl
parente1505232e21b6cb52921fc9bb8ee29f2772ab4a8 (diff)
downloadccwl-0d3e584d03131aae13aeaedfb2451d673b6d91f7.tar.gz
ccwl-0d3e584d03131aae13aeaedfb2451d673b6d91f7.tar.lz
ccwl-0d3e584d03131aae13aeaedfb2451d673b6d91f7.zip
Filter out global workflow inputs from workflow outputs.
* ccwl/ccwl.scm (key->output): New function. (workflow-steps): Filter out global workflow inputs from workflow-outputs.
Diffstat (limited to 'ccwl')
-rw-r--r--ccwl/ccwl.scm30
1 files changed, 19 insertions, 11 deletions
diff --git a/ccwl/ccwl.scm b/ccwl/ccwl.scm
index 91ef814..0848c45 100644
--- a/ccwl/ccwl.scm
+++ b/ccwl/ccwl.scm
@@ -398,6 +398,20 @@ list of supplied input <key> objects."
;; any other unrecognized syntax
(x (error "Unrecognized syntax:" (syntax->datum #'x)))))
+(define (key->output key steps)
+ "Return the <output> object corresponding to KEY, a <key> object, in
+STEPS, a list of <step> objects. If no such <output> object is found,
+return #f."
+ (and-let* ((step-with-output (find (lambda (step)
+ (eq? (step-id step)
+ (key-step key)))
+ steps))
+ (output (find (lambda (output)
+ (eq? (output-id output)
+ (key-name key)))
+ (step-out step-with-output))))
+ (set-output-source output (cwl-key-address key))))
+
(define-syntax workflow
(lambda (x)
(syntax-case x ()
@@ -414,16 +428,10 @@ list of supplied input <key> objects."
x
(make-workflow steps
inputs
- (map (lambda (key)
- (set-output-source
- (find (lambda (output)
- (eq? (output-id output)
- (key-name key)))
- (step-out (find (lambda (step)
- (eq? (step-id step)
- (key-step key)))
- steps)))
- (cwl-key-address key)))
- output-keys)))))
+ ;; Find the output object for each
+ ;; output key. Filter out global
+ ;; workflow inputs.
+ (filter-map (cut key->output <> steps)
+ output-keys)))))
(x (error "Unrecognized workflow syntax [expected (workflow (input ...) tree)]:"
(syntax->datum #'x))))))