From 0d3e584d03131aae13aeaedfb2451d673b6d91f7 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Tue, 1 Jun 2021 14:04:59 +0530 Subject: 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. --- ccwl/ccwl.scm | 30 +++++++++++++++++++----------- 1 file 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 objects." ;; any other unrecognized syntax (x (error "Unrecognized syntax:" (syntax->datum #'x))))) +(define (key->output key steps) + "Return the object corresponding to KEY, a object, in +STEPS, a list of objects. If no such 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 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)))))) -- cgit v1.2.3