14198: Initial support ClusterTarget hint
authorPeter Amstutz <pamstutz@veritasgenetics.com>
Wed, 24 Oct 2018 18:45:21 +0000 (14:45 -0400)
committerPeter Amstutz <pamstutz@veritasgenetics.com>
Wed, 21 Nov 2018 17:44:28 +0000 (12:44 -0500)
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz@veritasgenetics.com>

sdk/cwl/arvados_cwl/__init__.py
sdk/cwl/arvados_cwl/arv-cwl-schema.yml
sdk/cwl/arvados_cwl/arvcontainer.py

index 2e1ea50a389485ec0d5cdcdf0f044ac20e7d1080..0866f69d6e29817994e01b7c954e4cf150d280a4 100644 (file)
@@ -898,7 +898,8 @@ def add_arv_hints():
         "http://arvados.org/cwl#APIRequirement",
         "http://commonwl.org/cwltool#LoadListingRequirement",
         "http://arvados.org/cwl#IntermediateOutput",
-        "http://arvados.org/cwl#ReuseRequirement"
+        "http://arvados.org/cwl#ReuseRequirement",
+        "http://arvados.org/cwl#ClusterTarget"
     ])
 
 def exit_signal_handler(sigcode, frame):
index 4f762192a2a386f3c08c0d17e5704eccbf8f65e3..94eaf9560cb1a91abf5781a4a80c73d3cea665f4 100644 (file)
@@ -232,4 +232,24 @@ $graph:
     coresMin:
       type: int?
       doc: Minimum cores allocated to cwl-runner
-      jsonldPredicate: "https://w3id.org/cwl/cwl#ResourceRequirement/coresMin"
\ No newline at end of file
+      jsonldPredicate: "https://w3id.org/cwl/cwl#ResourceRequirement/coresMin"
+
+- name: ClusterTarget
+  type: record
+  extends: cwl:ProcessRequirement
+  inVocab: false
+  doc: |
+    Specify where a workflow step should run
+  fields:
+    class:
+      type: string
+      doc: "Always 'arv:ClusterTarget'"
+      jsonldPredicate:
+        _id: "@type"
+        _type: "@vocab"
+    clusterID:
+      type: string?
+      doc: The cluster to run the container
+    ownerUUID:
+      type: string?
+      doc: The project that will own the container requests and intermediate collections
index b4d01019fc099179dc0cae6fcb36821bfeab0471..b46711af47ddccd976fe6bf8f1f4edbf1d66602c 100644 (file)
@@ -250,6 +250,15 @@ class ArvadosContainer(JobBase):
         if self.timelimit is not None:
             scheduling_parameters["max_run_time"] = self.timelimit
 
+        extra_submit_params = {}
+        cluster_target_req, _ = self.get_requirement("http://arvados.org/cwl#ClusterTarget")
+        if cluster_target_req:
+            cluster_id = cluster_target_req.get("clusterID")
+            if cluster_id:
+                extra_submit_params["cluster_id"] = cluster_id
+            if cluster_target_req.get("ownerUUID"):
+                container_request["owner_uuid"] = cluster_target_req.get("ownerUUID")
+
         container_request["output_name"] = "Output for step %s" % (self.name)
         container_request["output_ttl"] = self.output_ttl
         container_request["mounts"] = mounts
@@ -277,11 +286,13 @@ class ArvadosContainer(JobBase):
             if runtimeContext.submit_request_uuid:
                 response = self.arvrunner.api.container_requests().update(
                     uuid=runtimeContext.submit_request_uuid,
-                    body=container_request
+                    body=container_request,
+                    **extra_submit_params
                 ).execute(num_retries=self.arvrunner.num_retries)
             else:
                 response = self.arvrunner.api.container_requests().create(
-                    body=container_request
+                    body=container_request,
+                    **extra_submit_params
                 ).execute(num_retries=self.arvrunner.num_retries)
 
             self.uuid = response["uuid"]