

@spin_first
def shutdown(self, targets=None, restart=False, hub=False, block=None):
    'Terminates one or more engine processes, optionally including the hub.'
    block = (self.block if (block is None) else block)
    if hub:
        targets = 'all'
    targets = self._build_targets(targets)[0]
    for t in targets:
        self.session.send(self._control_socket, 'shutdown_request', content={
            'restart': restart,
        }, ident=t)
    error = False
    if (block or hub):
        self._flush_ignored_control()
        for i in range(len(t)):
            (idents, msg) = self.session.recv(self._control_socket, 0)
            if self.debug:
                pprint(msg)
            if (msg['content']['status'] != 'ok'):
                error = self._unwrap_exception(msg['content'])
    else:
        self._ignored_control_replies += len(targets)
    if hub:
        time.sleep(0.25)
        self.session.send(self._query_socket, 'shutdown_request')
        (idents, msg) = self.session.recv(self._query_socket, 0)
        if self.debug:
            pprint(msg)
        if (msg['content']['status'] != 'ok'):
            error = self._unwrap_exception(msg['content'])
    if error:
        raise error

dataset/ETHPy150Open ipython/ipython-py3k/IPython/parallel/client/client.py Client.shutdown/VarMisuse@131/173 `targets`->`t`