How to use the pebble.TaskCancelled function in Pebble

To help you get started, we’ve selected a few Pebble examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github noxdafox / pebble / tests / test_process_concurrent.py View on Github external
def test_cancel_decorated_callback(self):
        """Process Concurrent TaskCancelled is forwarded to callback."""
        task = long_decorated_callback()
        task.cancel()
        event.wait()
        self.assertTrue(isinstance(exception, TaskCancelled))
github noxdafox / pebble / tests / test_decorators.py View on Github external
def test_thread_pool_cancel(self):
        """ThreadPoolDecorator callback gets notification if Task is cancelled."""
        tjob_pool_long.callback = self.error_callback
        task = tjob_pool_long(1, 1)
        task.cancel()
        event.wait()
        self.assertTrue(isinstance(self.exception, TaskCancelled))
github noxdafox / pebble / tests / test_process_task.py View on Github external
def test_cancel_decorated_callback(self):
        """Process Task TaskCancelled is forwarded to callback."""
        task = long_decorated_callback()
        task.cancel()
        event.wait()
        self.assertTrue(isinstance(exception, TaskCancelled))
github noxdafox / pebble / tests / test_process_concurrent.py View on Github external
def test_cancel_decorated(self):
        """Process Concurrent concurrent raises ConcurrentCancelled if so."""
        task = long_decorated()
        task.cancel()
        self.assertRaises(TaskCancelled, task.get)
github noxdafox / pebble / tests / test_decorators.py View on Github external
def test_thread_cancelled(self):
        """ThreadDecorator TaskCancelled is raised if task is cancelled."""
        task = tjob_long()
        task.cancel()
        self.assertRaises(TaskCancelled, task.get)
github noxdafox / pebble / tests / test_process_task.py View on Github external
def test_cancel_decorated(self):
        """Process Task task raises TaskCancelled if so."""
        task = long_decorated()
        task.cancel()
        self.assertRaises(TaskCancelled, task.get)
github noxdafox / pebble / tests / test_decorators.py View on Github external
def test_process_cancelled(self):
        """ProcessDecorator TaskCancelled is raised if task is cancelled."""
        task = pjob_long()
        task.cancel()
        self.assertRaises(TaskCancelled, task.get)
github noxdafox / pebble / tests / test_thread_pool.py View on Github external
def test_thread_pool_cancel(self):
        """Thread Pool task raises TaskCancelled if so."""
        with thread.Pool() as pool:
            task = pool.schedule(long_function)
            task.cancel()
        self.assertRaises(TaskCancelled, task.get)
github noxdafox / pebble / tests / test_thread_task.py View on Github external
def test_cancel_decorated(self):
        """Thread Task task raises TaskCancelled if so."""
        task = long_decorated()
        task.cancel()
        self.assertRaises(TaskCancelled, task.get)
github noxdafox / pebble / tests / test_thread_concurrent.py View on Github external
def test_cancel_decorated(self):
        """Thread Concurrent task raises TaskCancelled if so."""
        task = long_decorated()
        task.cancel()
        self.assertRaises(TaskCancelled, task.get)