def check_workers(workers, worker_sockets, log_fh=None):
 for (worker, sock) in zip(workers, worker_sockets):
  try:
   sock.send('')
  except error:
   if log_fh:
    log_fh.write(('FATAL ERROR\nWorker %s not alive. Aborting\n' % worker))
   stop_workers(worker_sockets, log_fh)
   return False
 return True

def check_workers ( workers , worker_sockets , log_fh = None ) : for ( worker , sock ) in zip ( workers , worker_sockets ) : try : sock . send ( '' ) except error : if log_fh : log_fh . write ( ( 'FATAL ERROR\nWorker %s not alive. Aborting\n' % worker ) ) stop_workers ( worker_sockets , log_fh ) return False return True
check if all workers are still alive .