def terminate_idle_children(self): for slot, idle in enumerate(self._idle): pid = self._pids[slot] if idle: print '==> Killing idle pid {}'.format(pid) kill(pid, signal.SIGKILL) #os.waitpid(pid, 0) # necessary? else: print '==> Waiting for pid {} (still busy)'.format(pid)
def kill_children(self): """ Force-kill all children. This function should block until all children are terminated. """ # As soon as we can acquire all slots, we're done executing for pid in self._pids: if pid != 0: print 'killing pid %d...' % (pid,) kill(pid, signal.SIGKILL) self.wait_for_children()
def kill_children(self): """ Force-kill all children. This function should block until all children are terminated. """ # As soon as we can acquire all slots, we're done executing for pid in self._pids: if pid != 0: print 'killing pid %d...' % (pid, ) kill(pid, signal.SIGKILL) self.wait_for_children()