Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@musically-ut
Created October 20, 2011 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save musically-ut/1301261 to your computer and use it in GitHub Desktop.
Save musically-ut/1301261 to your computer and use it in GitHub Desktop.
On demand killing.
try:
(r, w, e) = zmq.select([in_hb, in_cmd], [], [], timeout=end_time - time.time())
for sock in r:
msg = sock.recv()
# ...
if sock == in_cmd:
print '[monitor] Order to execute'
all_is_well = False
retcode = 'Killed by order'
continue
except ZMQError:
# ...
if not all_is_well:
if not _kill(p):
print '[monitor] Probably already dead.'
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment