diff --git a/IPython/parallel/client/client.py b/IPython/parallel/client/client.py index d4ca515..7b8735f 100644 --- a/IPython/parallel/client/client.py +++ b/IPython/parallel/client/client.py @@ -886,11 +886,14 @@ class Client(HasTraits): jobs : msg_id, list of msg_ids, or AsyncResult The jobs to be aborted - + + If unspecified/None: abort all outstanding jobs. """ block = self.block if block is None else block + jobs = jobs if jobs is not None else list(self.outstanding) targets = self._build_targets(targets)[0] + msg_ids = [] if isinstance(jobs, (basestring,AsyncResult)): jobs = [jobs] diff --git a/IPython/parallel/client/view.py b/IPython/parallel/client/view.py index 100cef7..48af67f 100644 --- a/IPython/parallel/client/view.py +++ b/IPython/parallel/client/view.py @@ -271,6 +271,8 @@ class View(HasTraits): """ block = block if block is not None else self.block targets = targets if targets is not None else self.targets + jobs = jobs if jobs is not None else list(self.outstanding) + return self.client.abort(jobs=jobs, targets=targets, block=block) def queue_status(self, targets=None, verbose=False): diff --git a/IPython/parallel/tests/test_view.py b/IPython/parallel/tests/test_view.py index c641c9b..6e3e559 100644 --- a/IPython/parallel/tests/test_view.py +++ b/IPython/parallel/tests/test_view.py @@ -292,7 +292,16 @@ class TestView(ClusterTestCase): view.abort(ar3.msg_ids) self.assertRaises(error.TaskAborted, ar2.get) self.assertRaises(error.TaskAborted, ar3.get) - + + def test_abort_all(self): + """view.abort() aborts all outstanding tasks""" + view = self.client[-1] + ars = [ view.apply_async(time.sleep, 1) for i in range(10) ] + view.abort() + view.wait(timeout=5) + for ar in ars[5:]: + self.assertRaises(error.TaskAborted, ar.get) + def test_temp_flags(self): view = self.client[-1] view.block=True