[ARVADOS] created: ac21f0d45a76294aaca0c0c0fdf06eb72d03368d

git at public.curoverse.com git at public.curoverse.com
Wed Nov 12 16:10:06 EST 2014


        at  ac21f0d45a76294aaca0c0c0fdf06eb72d03368d (commit)


commit ac21f0d45a76294aaca0c0c0fdf06eb72d03368d
Author: Tim Pierce <twp at curoverse.com>
Date:   Wed Nov 12 16:07:15 2014 -0500

    3609: fix "NameError: name 'rcode' is not defined"
    
    If run-command raises an exception in the main 'try' loop before any
    subprocesses have run, rcode will not be defined and "not any([status !=
    0 for status in rcode.values()])" will raise a confusing "NameError:
    name 'rcode' is not defined" exception.
    
    Solution is to define rcode before the try/except block and to make sure
    'success' is False if rcode is completely empty.

diff --git a/crunch_scripts/run-command b/crunch_scripts/run-command
index 3dafc97..13ae918 100755
--- a/crunch_scripts/run-command
+++ b/crunch_scripts/run-command
@@ -348,6 +348,8 @@ except Exception as e:
     logger.error(pprint.pformat(taskp))
     sys.exit(1)
 
+# rcode holds the return codes produced by each subprocess
+rcode = {}
 try:
     subprocesses = []
     close_streams = []
@@ -389,7 +391,6 @@ try:
 
     active = 1
     pids = set([s.pid for s in subprocesses])
-    rcode = {}
     while len(pids) > 0:
         (pid, status) = os.wait()
         pids.discard(pid)
@@ -434,7 +435,7 @@ else:
     outcollection = robust_put.upload(outdir, logger)
 
 # Success if no non-zero return codes
-success = not any([status != 0 for status in rcode.values()])
+success = any(rcode) and not any([status != 0 for status in rcode.values()])
 
 api.job_tasks().update(uuid=arvados.current_task()['uuid'],
                                      body={

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list