Show More
@@ -886,11 +886,14 b' class Client(HasTraits):' | |||||
886 |
|
886 | |||
887 | jobs : msg_id, list of msg_ids, or AsyncResult |
|
887 | jobs : msg_id, list of msg_ids, or AsyncResult | |
888 | The jobs to be aborted |
|
888 | The jobs to be aborted | |
889 |
|
889 | |||
|
890 | If unspecified/None: abort all outstanding jobs. | |||
890 |
|
891 | |||
891 | """ |
|
892 | """ | |
892 | block = self.block if block is None else block |
|
893 | block = self.block if block is None else block | |
|
894 | jobs = jobs if jobs is not None else list(self.outstanding) | |||
893 | targets = self._build_targets(targets)[0] |
|
895 | targets = self._build_targets(targets)[0] | |
|
896 | ||||
894 | msg_ids = [] |
|
897 | msg_ids = [] | |
895 | if isinstance(jobs, (basestring,AsyncResult)): |
|
898 | if isinstance(jobs, (basestring,AsyncResult)): | |
896 | jobs = [jobs] |
|
899 | jobs = [jobs] |
@@ -271,6 +271,8 b' class View(HasTraits):' | |||||
271 | """ |
|
271 | """ | |
272 | block = block if block is not None else self.block |
|
272 | block = block if block is not None else self.block | |
273 | targets = targets if targets is not None else self.targets |
|
273 | targets = targets if targets is not None else self.targets | |
|
274 | jobs = jobs if jobs is not None else list(self.outstanding) | |||
|
275 | ||||
274 | return self.client.abort(jobs=jobs, targets=targets, block=block) |
|
276 | return self.client.abort(jobs=jobs, targets=targets, block=block) | |
275 |
|
277 | |||
276 | def queue_status(self, targets=None, verbose=False): |
|
278 | def queue_status(self, targets=None, verbose=False): |
@@ -292,7 +292,16 b' class TestView(ClusterTestCase):' | |||||
292 | view.abort(ar3.msg_ids) |
|
292 | view.abort(ar3.msg_ids) | |
293 | self.assertRaises(error.TaskAborted, ar2.get) |
|
293 | self.assertRaises(error.TaskAborted, ar2.get) | |
294 | self.assertRaises(error.TaskAborted, ar3.get) |
|
294 | self.assertRaises(error.TaskAborted, ar3.get) | |
295 |
|
|
295 | ||
|
296 | def test_abort_all(self): | |||
|
297 | """view.abort() aborts all outstanding tasks""" | |||
|
298 | view = self.client[-1] | |||
|
299 | ars = [ view.apply_async(time.sleep, 1) for i in range(10) ] | |||
|
300 | view.abort() | |||
|
301 | view.wait(timeout=5) | |||
|
302 | for ar in ars[5:]: | |||
|
303 | self.assertRaises(error.TaskAborted, ar.get) | |||
|
304 | ||||
296 | def test_temp_flags(self): |
|
305 | def test_temp_flags(self): | |
297 | view = self.client[-1] |
|
306 | view = self.client[-1] | |
298 | view.block=True |
|
307 | view.block=True |
General Comments 0
You need to be logged in to leave comments.
Login now