[ARVADOS] updated: c0cda7d557efe50ab2e817a0bb920e8f1c8f73f7

git at public.curoverse.com git at public.curoverse.com
Mon Jul 7 11:47:00 EDT 2014


Summary of changes:
 crunch_scripts/arvados-bcbio-nextgen.py | 30 ++++++++++++++++++++++++++++++
 crunch_scripts/run-command              | 14 +++-----------
 2 files changed, 33 insertions(+), 11 deletions(-)

       via  c0cda7d557efe50ab2e817a0bb920e8f1c8f73f7 (commit)
      from  4a25da032d4de7452c498b9720ce0e294bd03816 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit c0cda7d557efe50ab2e817a0bb920e8f1c8f73f7
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Mon Jul 7 11:46:56 2014 -0400

    arvados-bcbio-nextgen writes output now.  Put write_directory_tree under the
    try/except block in run-command.  Tweaked return code output.  no issue #

diff --git a/crunch_scripts/arvados-bcbio-nextgen.py b/crunch_scripts/arvados-bcbio-nextgen.py
index 0d3618b..37ac7d3 100755
--- a/crunch_scripts/arvados-bcbio-nextgen.py
+++ b/crunch_scripts/arvados-bcbio-nextgen.py
@@ -103,3 +103,33 @@ os.chdir("project1/work")
 os.symlink("/usr/local/share/bcbio-nextgen/galaxy/tool-data", "tool-data")
 
 rcode = subprocess.call(["bcbio_nextgen.py", "../config/project1.yaml", "-n", os.environ['CRUNCH_NODE_SLOTS']])
+
+print("run-command: completed with exit code %i (%s)" % (rcode, "success" if rcode == 0 else "failed"))
+
+if rcode == 0:
+    os.chdir("../final")
+
+    print("arvados-bcbio-nextgen: the follow output files will be saved to keep:")
+
+    subprocess.call(["find", ".", "-type", "f", "-printf", "arvados-bcbio-nextgen: %12.12s %h/%f\\n"])
+
+    print("arvados-bcbio-nextgen: start writing output to keep")
+
+    done = False
+    while not done:
+        try:
+            out = arvados.CollectionWriter()
+            out.write_directory_tree(".", max_manifest_depth=0)
+            outuuid = out.finish()
+            api.job_tasks().update(uuid=arvados.current_task()['uuid'],
+                                                 body={
+                                                     'output':outuuid,
+                                                     'success': (rcode == 0),
+                                                     'progress':1.0
+                                                 }).execute()
+            done = True
+        except Exception as e:
+            print("arvados-bcbio-nextgen: caught exception: {}".format(e))
+            time.sleep(5)
+
+sys.exit(rcode)
diff --git a/crunch_scripts/run-command b/crunch_scripts/run-command
index 2eb5589..268c038 100755
--- a/crunch_scripts/run-command
+++ b/crunch_scripts/run-command
@@ -61,7 +61,7 @@ try:
 
     rcode = subprocess.call(cmd, stdout=stdoutfile)
 
-    print("run-command: completed with exit code %i" % rcode)
+    print("run-command: completed with exit code %i (%s)" % (rcode, "success" if rcode == 0 else "failed"))
 
 except Exception as e:
     print("run-command: caught exception: {}".format(e))
@@ -76,11 +76,11 @@ finally:
 
     print("run-command: start writing output to keep")
 
-    out = arvados.CollectionWriter()
-    out.write_directory_tree(".", max_manifest_depth=0)
     done = False
     while not done:
         try:
+            out = arvados.CollectionWriter()
+            out.write_directory_tree(".", max_manifest_depth=0)
             outuuid = out.finish()
             api.job_tasks().update(uuid=arvados.current_task()['uuid'],
                                                  body={
@@ -93,12 +93,4 @@ finally:
             print("run-command: caught exception: {}".format(e))
             time.sleep(5)
 
-if rcode == 0:
-    os.chdir("..")
-    shutil.rmtree("tmpdir")
-    shutil.rmtree("output")
-    print("run-command: success")
-else:
-    print("run-command: failed")
-
 sys.exit(rcode)

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list