

@spin_first
def abort(self, jobs=None, targets=None, block=None):
    'Abort specific jobs from the execution queues of target(s).\n        \n        This is a mechanism to prevent jobs that have already been submitted\n        from executing.\n        \n        Parameters\n        ----------\n        \n        jobs : msg_id, list of msg_ids, or AsyncResult\n            The jobs to be aborted\n        \n        \n        '
    block = (self.block if (block is None) else block)
    targets = self._build_targets(targets)[0]
    msg_ids = []
    if isinstance(jobs, (str, AsyncResult)):
        jobs = [jobs]
    bad_ids = [obj for obj in jobs if (not isinstance(obj, (str, AsyncResult)))]
    if bad_ids:
        raise TypeError(('Invalid msg_id type %r, expected str or AsyncResult' % bad_ids[0]))
    for j in jobs:
        if isinstance(j, AsyncResult):
            msg_ids.extend(j.msg_ids)
        else:
            msg_ids.append(j)
    content = dict(msg_ids=msg_ids)
    for t in targets:
        self.session.send(self._control_socket, 'abort_request', content=content, ident=t)
    error = False
    if block:
        self._flush_ignored_control()
        for i in range(len(targets)):
            (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 error:
        raise error

dataset/ETHPy150Open ipython/ipython-py3k/IPython/parallel/client/client.py Client.abort/original