about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Amstutz2020-07-17 14:55:19 -0400
committerPeter Amstutz2020-07-17 14:55:19 -0400
commitb34f5f42b9bd7a522b9d9b22d736998c4815d9e7 (patch)
tree5fed256bb0e90f7aeb54d9d0cf76bfb1e2ba82b6
parentabdf121de73e4fdc8144c988f724ad7c04fe235c (diff)
downloadbh20-seq-resource-b34f5f42b9bd7a522b9d9b22d736998c4815d9e7.tar.gz
bh20-seq-resource-b34f5f42b9bd7a522b9d9b22d736998c4815d9e7.tar.lz
bh20-seq-resource-b34f5f42b9bd7a522b9d9b22d736998c4815d9e7.zip
Make sure move_fastq_to_fasta_results gets everything
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz@curii.com>
-rw-r--r--bh20seqanalyzer/main.py37
1 files changed, 20 insertions, 17 deletions
diff --git a/bh20seqanalyzer/main.py b/bh20seqanalyzer/main.py
index b3a439d..ad3c3d7 100644
--- a/bh20seqanalyzer/main.py
+++ b/bh20seqanalyzer/main.py
@@ -211,9 +211,10 @@ class SeqAnalyzer:
         self.run_workflow(self.pangenome_analysis_project, self.pangenome_workflow_uuid, "Pangenome analysis", inputobj)
 
 
-    def get_workflow_output_from_project(self, uuid):
+    def get_workflow_output_from_project(self, uuid, named):
         cr = self.api.container_requests().list(filters=[['owner_uuid', '=', uuid],
-                                                    ["requesting_container_uuid", "=", None]]).execute()
+                                                         ["requesting_container_uuid", "=", None],
+                                                         ["name", "=", named]]).execute()
         if cr["items"] and cr["items"][0]["output_uuid"]:
             container = self.api.containers().get(uuid=cr["items"][0]["container_uuid"]).execute()
             if container["state"] == "Complete" and container["exit_code"] == 0:
@@ -225,24 +226,26 @@ class SeqAnalyzer:
         most_recent_analysis = self.api.groups().list(filters=[['owner_uuid', '=', self.pangenome_analysis_project]],
                                                       order="created_at desc").execute()
         for m in most_recent_analysis["items"]:
-            wf = self.get_workflow_output_from_project(m["uuid"])
-            if wf:
-                src = self.api.collections().get(uuid=wf["output_uuid"]).execute()
-                dst = self.api.collections().get(uuid=self.latest_result_uuid).execute()
-                if src["portable_data_hash"] != dst["portable_data_hash"]:
-                    logging.info("Copying latest result from '%s' to %s", m["name"], self.latest_result_uuid)
-                    self.api.collections().update(uuid=self.latest_result_uuid,
-                                             body={"manifest_text": src["manifest_text"],
-                                                   "description": "Result from %s %s" % (m["name"], wf["uuid"])}).execute()
-                break
+            wf = self.get_workflow_output_from_project(m["uuid"], "pangenome-generate.cwl")
+            if wf is None:
+                continue
+            src = self.api.collections().get(uuid=wf["output_uuid"]).execute()
+            dst = self.api.collections().get(uuid=self.latest_result_uuid).execute()
+            if src["portable_data_hash"] != dst["portable_data_hash"]:
+                logging.info("Copying latest result from '%s' to %s", m["name"], self.latest_result_uuid)
+                self.api.collections().update(uuid=self.latest_result_uuid,
+                                         body={"manifest_text": src["manifest_text"],
+                                               "description": "Result from %s %s" % (m["name"], wf["uuid"])}).execute()
+            break
 
 
     def move_fastq_to_fasta_results(self):
-        projects = self.api.groups().list(filters=[['owner_uuid', '=', self.fastq_project],
-                                              ["properties.moved_output", "!=", True]],
-                                     order="created_at asc",).execute()
-        for p in projects["items"]:
-            wf = self.get_workflow_output_from_project(p["uuid"])
+        projects = arvados.util.list_all(self.api.groups().list,
+                                         filters=[['owner_uuid', '=', self.fastq_project],
+                                                ["properties.moved_output", "!=", True]],
+                                         order="created_at asc")
+        for p in projects:
+            wf = self.get_workflow_output_from_project(p["uuid"], "fastq2fasta.cwl")
             if not wf:
                 continue