environment/share/doc/ipython/examples/parallel/workflow/wmanager.py
def cleanup(controller, engines):
    """Cleanup routine to shut down all subprocesses we opened."""
    import signal, time
    
    print('Starting cleanup')
    print('Stopping engines...')
    for e in engines:
        e.send_signal(signal.SIGINT)
    print('Stopping controller...')
    # so it can shut down its queues
    controller.send_signal(signal.SIGINT)
    time.sleep(0.1)
    print('Killing controller...')
    controller.kill()
    print('Cleanup done')
def cleanup(controller, engines):
    """Cleanup routine to shut down all subprocesses we opened."""
    import signal, time
    
    print('Starting cleanup')
    print('Stopping engines...')
    for e in engines:
        e.send_signal(signal.SIGINT)
    print('Stopping controller...')
    # so it can shut down its queues
    controller.send_signal(signal.SIGINT)
    time.sleep(0.1)
    print('Killing controller...')
    controller.kill()
    print('Cleanup done')
Cleanup routine to shut down all subprocesses we opened.