summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2021-02-25 13:55:02 +0530
committerArun Isaac2021-02-25 14:01:09 +0530
commit14b037c135889579013f34534374b46ee491a1d4 (patch)
treeca4e86e185f299a33b07c83ea4b2eaee28e465c6
parent2df1921c9abf756eb2bcb9e99f8ba02eae1a8c53 (diff)
downloadccwl-14b037c135889579013f34534374b46ee491a1d4.tar.gz
ccwl-14b037c135889579013f34534374b46ee491a1d4.tar.lz
ccwl-14b037c135889579013f34534374b46ee491a1d4.zip
Support embedding clitool into a workflow step.
* generate-cwl/generate-cwl.scm: Export intermediate and clitool-step. (<intermediate>): New type. (clitool-step): New function. (workflow): Pull out inputs and intermediate put into <step> objects by clitool-step.
-rw-r--r--generate-cwl/generate-cwl.scm35
1 files changed, 33 insertions, 2 deletions
diff --git a/generate-cwl/generate-cwl.scm b/generate-cwl/generate-cwl.scm
index 03ce77d..4e6420a 100644
--- a/generate-cwl/generate-cwl.scm
+++ b/generate-cwl/generate-cwl.scm
@@ -13,7 +13,9 @@
input
output
step
- workflow-output))
+ workflow-output
+ intermediate
+ clitool-step))
(define-record-type (<input> make-input input?)
(fields (immutable id input-id)
@@ -38,6 +40,29 @@
"Build and return an <output> object."
(make-output id type binding other))
+(define-record-type (<intermediate> intermediate intermediate?)
+ (fields (immutable input intermediate-input)
+ (immutable output-source intermediate-output-source)))
+
+(define* (clitool-step id args #:key (additional-inputs '()) (outputs '()) stdout stderr (other '()))
+ (step id
+ (clitool (map (lambda (arg)
+ (if (intermediate? arg)
+ (intermediate-input arg)
+ arg))
+ args)
+ #:additional-inputs additional-inputs
+ #:outputs outputs
+ #:stdout stdout
+ #:stderr stderr
+ #:other other)
+ (append (filter (lambda (arg)
+ (or (input? arg)
+ (intermediate? arg)))
+ args)
+ additional-inputs)
+ (map output-id outputs)))
+
(define* (parse-arguments args #:optional (position 1))
"Parse ARGS, a list of command line arguments and return a parse
tree of labelled arguments. POSITION is an internal recursion
@@ -156,6 +181,7 @@ lists---the base command and the actual arguments."
(append-map (lambda (step)
(filter-map (match-lambda
((id . (? input? input)) input)
+ ((? input? input) input)
(_ #f))
(step-in step)))
steps)
@@ -176,7 +202,12 @@ lists---the base command and the actual arguments."
((id . input)
(cons id (if (input? input)
(input-id input)
- input))))
+ input)))
+ ((? input? input)
+ (cons (input-id input) (input-id input)))
+ ((? intermediate? intermediate)
+ (cons (input-id (intermediate-input intermediate))
+ (intermediate-output-source intermediate))))
(step-in step)))
(out . ,(list->vector (step-out step)))
(run . ,(step-run step))))