An object to manager 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
Parameter |
Default |
Description |
app
App
|
required
|
An App instance. |
add_worker
method
def add_worker(self, worker, start=True, exclusive=True):
Add a new worker.
Parameters
Parameter |
Default |
Description |
worker
Worker
|
required
|
A Worker instance. |
start
bool
|
True
|
Start the worker if True, otherwise the worker must be started manually. |
exclusive
bool
|
True
|
Cancel all workers in the same group as worker . |
cancel_group
method
def cancel_group(self, node, group):
Cancel a single group.
Parameters
Parameter |
Default |
Description |
node
DOMNode
|
required
|
Worker DOM node. |
group
str
|
required
|
A group name. |
Returns
Type |
Description |
list[Worker]
|
A list of workers that were cancelled. |
cancel_node
method
def cancel_node(self, node):
Cancel all workers associated with a given node
Parameters
Parameter |
Default |
Description |
node
DOMNode
|
required
|
A DOM node (widget, screen, or App). |
Returns
Type |
Description |
list[Worker]
|
List of cancelled workers. |
wait_for_complete
async
def wait_for_complete(self, workers=None):
Wait for workers to complete.
Parameters
Parameter |
Default |
Description |
workers
Iterable[Worker] | None
|
None
|
An iterable of workers or None to wait for all workers in the manager. |