Skip to content

Commit

Permalink
Merge pull request #3600 from chapmanb/master
Browse files Browse the repository at this point in the history
Improved logging for errors during BatchLauncher.stop

This is a logging/debugging improvement that catches and reports errors when shutting down clusters using a BatchLauncher (qdel/bkill). The previous behavior was to silently fail if the external command failed. The patch captures error output and reports potential issues to the log.
  • Loading branch information
minrk committed Jul 10, 2013
2 parents f3dfb93 + 23ff2ea commit 99909ae
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion IPython/parallel/apps/launcher.py
Expand Up @@ -1132,7 +1132,15 @@ def start(self, n):
return job_id

def stop(self):
output = check_output(self.delete_command+[self.job_id], env=os.environ)
try:
p = Popen(self.delete_command+[self.job_id], env=os.environ,
stdout=PIPE, stderr=PIPE)
out, err = p.communicate()
output = out + err
except:
self.log.exception("Problem stopping cluster with command: %s" %
(self.delete_command + [self.job_id]))
output = ""
output = output.decode(DEFAULT_ENCODING, 'replace')
self.notify_stop(dict(job_id=self.job_id, output=output)) # Pass the output of the kill cmd
return output
Expand Down

0 comments on commit 99909ae

Please sign in to comment.