aboutsummaryrefslogtreecommitdiff
path: root/ccwl/ccwl.scm
diff options
context:
space:
mode:
authorArun Isaac2023-12-01 22:41:17 +0000
committerArun Isaac2023-12-01 22:54:33 +0000
commitd63f2df9d10ab425930900283323aba4b96b8a8c (patch)
tree0ddef6c50b0ae1ba77bb465674b83599dc842ba1 /ccwl/ccwl.scm
parentd5fadbd7d93fe047a37591a149bae007c359b88c (diff)
downloadccwl-d63f2df9d10ab425930900283323aba4b96b8a8c.tar.gz
ccwl-d63f2df9d10ab425930900283323aba4b96b8a8c.tar.lz
ccwl-d63f2df9d10ab425930900283323aba4b96b8a8c.zip
ccwl: Deduplicate global workflow input keys across tee branches.
* ccwl/ccwl.scm (collect-steps): Deduplicate global workflow input keys across branches of tees. * tests/ccwl.scm (key, collect-steps): New variables. ("rename should work even on the final output of a workflow"): Update order of elements in expected list. ("tee must deduplicate global workflow input keys"): New test. * ccwl/utils.scm (append-mapn): Delete function. * tests/utils.scm ("append-mapn"): Delete test.
Diffstat (limited to 'ccwl/ccwl.scm')
-rw-r--r--ccwl/ccwl.scm11
1 files changed, 9 insertions, 2 deletions
diff --git a/ccwl/ccwl.scm b/ccwl/ccwl.scm
index bbc5de1..743944d 100644
--- a/ccwl/ccwl.scm
+++ b/ccwl/ccwl.scm
@@ -636,8 +636,15 @@ represented by <step> objects."
(list)))
;; tee
((tee expressions ...)
- (append-mapn (cut collect-steps <> input-keys)
- #'(expressions ...)))
+ (let ((key-lists step-lists (mapn (cut collect-steps <> input-keys)
+ #'(expressions ...))))
+ (values
+ ;; Global workflow input keys may be duplicated across the
+ ;; branches of a tee. So, deduplicate them by treating key
+ ;; lists as sets. TODO: Error out if any keys other than
+ ;; global workflow inputs are duplicated.
+ (apply lset-union eq? key-lists)
+ (apply append step-lists))))
((identity)
(values input-keys (list)))
;; rename keys (base case)