summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2024-09-06 16:37:48 +0100
committerArun Isaac2024-09-06 16:40:30 +0100
commitd7bcf169f6b03433210b7c780ae343808bdc7492 (patch)
treec91acc67215947ef5f3ffd80507a63d8b6c6fe5e
parentc2acfb77efd60f8c7400ed013696016fce5f2431 (diff)
downloadravanan-d7bcf169f6b03433210b7c780ae343808bdc7492.tar.gz
ravanan-d7bcf169f6b03433210b7c780ae343808bdc7492.tar.lz
ravanan-d7bcf169f6b03433210b7c780ae343808bdc7492.zip
workflow: Extract scatter and scatterMethod.
* ravanan/command-line-tool.scm (<scheduler-proc>)[scatter,
scatter-method]: New fields.
* ravanan/workflow.scm (command-line-tool->propagator,
workflow-class->propagators): Initialize scatter and scatter-method in
scheduler-proc object.
-rw-r--r--ravanan/command-line-tool.scm10
-rw-r--r--ravanan/workflow.scm15
2 files changed, 20 insertions, 5 deletions
diff --git a/ravanan/command-line-tool.scm b/ravanan/command-line-tool.scm
index c943881..5bb9dac 100644
--- a/ravanan/command-line-tool.scm
+++ b/ravanan/command-line-tool.scm
@@ -62,7 +62,9 @@
             %command-line-tool-supported-requirements
             scheduler-proc
             scheduler-proc-name
-            scheduler-proc-cwl))
+            scheduler-proc-cwl
+            scheduler-proc-scatter
+            scheduler-proc-scatter-method))
 
 (define %store-files-directory
   "files")
@@ -96,10 +98,12 @@
   (exit #f))
 
 (define-immutable-record-type <scheduler-proc>
-  (scheduler-proc name cwl)
+  (scheduler-proc name cwl scatter scatter-method)
   scheduler-proc?
   (name scheduler-proc-name)
-  (cwl scheduler-proc-cwl))
+  (cwl scheduler-proc-cwl)
+  (scatter scheduler-proc-scatter)
+  (scatter-method scheduler-proc-scatter-method))
 
 (define-immutable-record-type <single-machine-job-state>
   (single-machine-job-state script success?)
diff --git a/ravanan/workflow.scm b/ravanan/workflow.scm
index 2ecc4e6..50052cb 100644
--- a/ravanan/workflow.scm
+++ b/ravanan/workflow.scm
@@ -126,7 +126,7 @@ requirements and hints of the step."
   "Convert @code{CommandLineTool} workflow @var{cwl} of @var{name} to a
 propagator."
   (propagator name
-              (scheduler-proc name cwl)
+              (scheduler-proc name cwl %nothing %nothing)
               (vector-map->list (lambda (input)
                                   (cons (assoc-ref input "id")
                                         (assoc-ref input "id")))
@@ -199,7 +199,18 @@ their own namespaces."
                                                 (assoc-ref step "run"))))
            (propagator (prefix-name step-id
                                     (propagator-name step-propagator))
-                       (propagator-proc step-propagator)
+                       ;; Augment proc with scatter and scatter method.
+                       (let ((proc (propagator-proc step-propagator)))
+                         (scheduler-proc
+                          (scheduler-proc-name proc)
+                          (scheduler-proc-cwl proc)
+                          (maybe-assoc-ref (just step) "scatter")
+                          (maybe-let* ((scatter-method
+                                        (maybe-assoc-ref (just step) "scatterMethod")))
+                            (just (assoc-ref* '(("dotproduct" . dot-product)
+                                                ("nested_crossproduct" . nested-cross-product)
+                                                ("flat_crossproduct" . flat-cross-product))
+                                              scatter-method)))))
                        (assoc-ref step "in")
                        (propagator-optional-inputs step-propagator)
                        (vector-map->list (lambda (output-name)