mosaic.parallel.BackgroundTaskManager.run_task#

BackgroundTaskManager.run_task(name, func, callback=None, instance=None, *args, **kwargs)[source]#

Run a function in a background thread.

Parameters:
namestr

A unique identifier for the task.

funccallable

The function to run.

callbackcallable, optional

callback function to call when task completes.

instanceobject, optional

Class instance to pass to the callback

*args: optional

Positional arguments to pass to func.

**kwarsoptional

Keyword arguments to pass to func.

Returns:
bool

True if task was started False otherwise.