An object to manage a number of workers.
You will not have to construct this class manually, as widgets, screens, and apps
have a worker manager accessibly via a workers attribute.
Parameters:
| Name |
Type |
Description |
Default |
app |
App
|
|
required
|
add_worker
add_worker(worker, start=True, exclusive=True)
Add a new worker.
Parameters:
| Name |
Type |
Description |
Default |
worker |
Worker
|
|
required
|
start |
bool
|
Start the worker if True, otherwise the worker must be started manually.
|
True
|
exclusive |
bool
|
Cancel all workers in the same group as worker.
|
True
|
cancel_group
cancel_group(node, group)
Cancel a single group.
Parameters:
| Name |
Type |
Description |
Default |
node |
DOMNode
|
|
required
|
group |
str
|
|
required
|
Returns:
| Type |
Description |
list[Worker]
|
A list of workers that were cancelled.
|
cancel_node
Cancel all workers associated with a given node
Parameters:
| Name |
Type |
Description |
Default |
node |
DOMNode
|
A DOM node (widget, screen, or App).
|
required
|
Returns:
| Type |
Description |
list[Worker]
|
List of cancelled workers.
|
wait_for_complete
async
wait_for_complete(workers=None)
Wait for workers to complete.
Parameters:
| Name |
Type |
Description |
Default |
workers |
Iterable[Worker] | None
|
An iterable of workers or None to wait for all workers in the manager.
|
None
|