projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' into 4951-request-vm
[arvados.git]
/
crunch_scripts
/
run-command
diff --git
a/crunch_scripts/run-command
b/crunch_scripts/run-command
index 3dafc970d34a192a81425aa808196cd8ca61e043..c07debd787eecfc6696c5d614d69c013f8028dd7 100755
(executable)
--- 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)
logger.error(pprint.pformat(taskp))
sys.exit(1)
+# rcode holds the return codes produced by each subprocess
+rcode = {}
try:
subprocesses = []
close_streams = []
try:
subprocesses = []
close_streams = []
@@
-389,7
+391,6
@@
try:
active = 1
pids = set([s.pid for s in subprocesses])
active = 1
pids = set([s.pid for s in subprocesses])
- rcode = {}
while len(pids) > 0:
(pid, status) = os.wait()
pids.discard(pid)
while len(pids) > 0:
(pid, status) = os.wait()
pids.discard(pid)
@@
-433,8
+434,8
@@
if "task.vwd" in taskp:
else:
outcollection = robust_put.upload(outdir, logger)
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 if
we ran any subprocess, and they all exited 0.
+success =
rcode and all(status == 0 for status in rcode.itervalues()
)
api.job_tasks().update(uuid=arvados.current_task()['uuid'],
body={
api.job_tasks().update(uuid=arvados.current_task()['uuid'],
body={
@@
-443,4
+444,4
@@
api.job_tasks().update(uuid=arvados.current_task()['uuid'],
'progress':1.0
}).execute()
'progress':1.0
}).execute()
-sys.exit(
rcode
)
+sys.exit(
0 if success else 1
)