How to use the pebble.thread 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_thread_concurrent.py View on Github external
@thread.concurrent(callback=callback)
def error_decorated_callback():
    raise Exception("BOOM!")
github noxdafox / pebble / tests / test_decorators.py View on Github external
            @thread(callback, 5)
            def wrong(argument, keyword_argument=0):
                return argument + keyword_argument
        except Exception as error:
github noxdafox / pebble / tests / test_thread_spawn.py View on Github external
@thread.spawn(name='foo')
def decorated(queue, argument, keyword_argument=0):
    """A docstring."""
    queue.put(argument + keyword_argument)
github noxdafox / pebble / tests / test_decorators.py View on Github external
@thread
def tjob_long():
    time.sleep(1)
    return 1
github noxdafox / pebble / tests / test_thread_pool.py View on Github external
def test_thread_pool_queue_factory(self):
        """Thread Pool queue factory is called."""
        with thread.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
@thread(callback=callback)
def tjob_callback(argument, keyword_argument=0):
    return argument + keyword_argument
github noxdafox / pebble / pebble / process / newpool.py View on Github external
@thread.spawn(name='pool_manager')
def pool_manager_loop(pool):
    while pool.alive:
        reset_expired_workers(pool)
        manage_tasks(pool)
        time.sleep(0.1)