RodTracker.backend.parallelism

TBD

class Worker(func, *args, **kwargs)[source]

Bases: QRunnable

Wrapper object for a function that shall be run in a thread other than the main thread.

Parameters:
  • func (callable) – Function to be run in a thread other than the main thread.

  • *args (Iterable) – Positional arguments func shall be run with.

  • **kwargs (dict) – Keyword arguments func shall be run with.

func

Function to be run in a thread other than the main thread.

Type:

callable

args

Positional arguments func will be run with.

Type:

Iterable

kwargs

Keyword arguments func will be run with.

Type:

dict

signals

Signals that can be emitted after the invocation of the Worker object.

Type:

WorkerSignals

run()[source]

Run the func with args and attr:kwargs as its parameters.

This function is not intended to be run directly but by invoking it via a QThreadPool.start(worker) call.

class WorkerSignals[source]

Bases: QObject

Helper object to provide Worker access to pyqtSignal.

error

Signal for propagating errors occuring in the Worker’s thread.

The transferred tuple should contain the following values:
[0]: Exception type
[1]: Exception value
[2]: Exception traceback

See also

sys.exc_info()

sys.exc_info

Type:

pyqtSignal(tuple)

finished

Signal to indicate a Worker has finished.

Type:

pyqtSignal()

result

Signal for reporting the results of a Worker.

Type:

pyqtSignal(object)

error_handler(func)[source]

Decorator function to provide proper error handling.

This function is intended as a wrapper for the QRunnable.run() function. It assumes that the QRunnable object has an attribute self.signals.error which is a pyqtSignal that expects the exception type, value, and traceback as its values.

See also

WorkerSignals, Worker