Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

view.abort() aborts all outstanding tasks

Behavior now matches what docstring always claimed (default=all).
  • Loading branch information...
commit 26dd0711f8391cb294c09bc4e0badc8f18054cc4 1 parent bdcfcc6
@minrk minrk authored
View
5 IPython/parallel/client/client.py
@@ -886,11 +886,14 @@ def abort(self, jobs=None, targets=None, block=None):
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]
View
2  IPython/parallel/client/view.py
@@ -271,6 +271,8 @@ def abort(self, jobs=None, targets=None, block=None):
"""
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):
View
11 IPython/parallel/tests/test_view.py
@@ -292,7 +292,16 @@ def test_abort(self):
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
Please sign in to comment.
Something went wrong with that request. Please try again.