How to use the pebble.process 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
@process.concurrent
def critical_decorated():
    os._exit(123)
github noxdafox / pebble / tests / test_decorators.py View on Github external
@process(timeout=2)
def pjob_long_timeout():
    return 1
github noxdafox / pebble / tests / test_process_pool.py View on Github external
def test_process_pool_queue_factory(self):
        """Process Pool queue factory is called."""
        with process.Pool(queue_factory=queue_factory) as pool:
            self.assertEqual(pool._context.task_queue.maxsize, 5)
github noxdafox / pebble / tests / test_decorators.py View on Github external
@process(callback=callback)
def pjob_callback(argument, keyword_argument=0):
    return argument + keyword_argument
github noxdafox / pebble / tests / test_process_spawn.py View on Github external
@process.spawn(name='foo')
def decorated_kword(queue, argument, keyword_argument=0):
    """A docstring."""
    queue.put(argument + keyword_argument)
github noxdafox / pebble / tests / test_process_pool.py View on Github external
def test_process_pool_broken_initializer(self):
        """Process Pool broken initializer is notified."""
        with self.assertRaises(PoolError):
            with pebble.process.Pool(initializer=broken_initializer) as pool:
                pool.schedule(function)
github noxdafox / pebble / tests / test_decorators.py View on Github external
@process
def pjob_error(argument, keyword_argument=0):
    raise Exception("BOOM!")
github noxdafox / pebble / tests / test_process_pool.py View on Github external
def tearDown(self):
        pebble.process.pool.worker_process = self.worker_process
        pebble.process.channel.LOCK_TIMEOUT = 60
github noxdafox / pebble / tests / test_process_pool.py View on Github external
def test_process_pool_error(self):
        """Process Pool errors are raised by task get."""
        with process.Pool() as pool:
            task = pool.schedule(error_function)
        self.assertRaises(Exception, task.get)