JobQueue

class farn.run.utils.threading.JobQueue(maxsize=0)

Bases: Queue[tuple[Any, Sequence[Any], Mapping[str, Any]]]

Queue for jobs to be executed by worker threads.

JobQueue extends threading.Queue. It provides an additional put_callable() method, allowing to put a callable with a generic list of arguments in the queue.

__init__(maxsize=0)

Methods

__init__([maxsize])

empty()

Return True if the queue is empty, False otherwise (not reliable!).

full()

Return True if the queue is full, False otherwise (not reliable!).

get([block, timeout])

Remove and return an item from the queue.

get_nowait()

Remove and return an item from the queue without blocking.

join()

Blocks until all items in the Queue have been gotten and processed.

put(item[, block, timeout])

Put an item into the queue.

put_callable(func, *args, **kwargs)

Put a callable object (function) in the JobQueue.

put_nowait(item)

Put an item into the queue without blocking.

qsize()

Return the approximate size of the queue (not reliable!).

task_done()

Indicate that a formerly enqueued task is complete.

put_callable(func: Callable[[...], Any], *args: Any, **kwargs: Any) None

Put a callable object (function) in the JobQueue.

Additional positional and keyword arguments provided with args and kwargs will be passed on to the called function.

Parameters:

func (Any) – the callable object (function)