How to use the pebble.process.task 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_task.py View on Github external
def test_undecorated_callback(self):
        """Process Task undecorated results are forwarded to the callback."""
        task = process.task(target=undecorated, args=[1],
                            kwargs={'keyword_argument': 1},
                            callback=self.callback)
        event.wait()
        self.assertEqual(task.get(), 2)
github noxdafox / pebble / tests / test_process_task.py View on Github external
@process.task(callback=callback)
def long_decorated_callback():
    time.sleep(1)
github noxdafox / pebble / tests / test_process_task.py View on Github external
@process.task
def decorated(argument, keyword_argument=0):
    """A docstring."""
    return argument + keyword_argument
github noxdafox / pebble / tests / test_process_task.py View on Github external
    @process.task
    def instmethod(self):
        return self.b
github noxdafox / pebble / tests / test_process_task.py View on Github external
def test_wrong_parameters(self):
        """Process Task raises ValueError if wrong params."""
        self.assertRaises(ValueError, process.task, undecorated,
                          args=[1])
github noxdafox / pebble / tests / test_process_task.py View on Github external
            @process.task(5, name='foo')
            def wrong():
                return
        except Exception as error:
github noxdafox / pebble / tests / test_process_task.py View on Github external
@process.task(callback=callback, timeout=0.2)
def timeout_decorated_callback():
    time.sleep(1)
github noxdafox / pebble / tests / test_process_task.py View on Github external
@process.task
def error_decorated():
    raise Exception("BOOM!")