Worker Task Manager
QRunnable multithreaded tasks: callback execution in Worker + WorkerSignals signalling back to the main thread.
Overview
quatm/GUI/widgets/browser_workers.py provides the worker task manager: Worker subclasses
QRunnable and executes a callback in the QThreadPool thread pool, then sends
finished / error / result / progress signals back to the main thread via WorkerSignals. It is used by
the experiment browser (experiment queue, looper, etc.); the isomorphic helper_workers is used by
alignment/auxiliary tools.
Components
| Component | Description |
|---|---|
Worker | QRunnable worker thread: setup, execution and teardown (including exception handling) |
WorkerSignals | Worker-thread signals: finished / error / result / progress, etc. |
Usage
from quatm.GUI.widgets.browser_workers import Worker
worker = Worker(fn=long_running, args=(...), kwargs={...})
worker.signals.result.connect(on_result)
QThreadPool.globalInstance().start(worker)
For a fuller description see Background worker threads.