puzzlestream.backend.worker module

Background worker module.

contains PSWorker

class puzzlestream.backend.worker.PSWorker(workerRegistrationFunction: Callable, startTimerFunction: Callable)[source]

Bases: object

Background worker class.

Every Puzzlestream module has exactly one worker that does all the heavy lifting in a background process without blocking the UI.

enqueue(streamSection: puzzlestream.backend.streamsection.PSStreamSection, currentID: int, lastID: int)[source]

Enqueue worker to be executed whenever there is a free slot.

finish(result: list)[source]

Run some finalising procedure when the worker has finished.

property finished

Signal that is emitted when the worker has finished (PSSignal).

property newStdout

Signal that is emitted when there is new output (PSSignal).

pause() → bool[source]

Pause the current process.

poll()[source]

Poll worker and see if there is new output or if it has finished.

property progressUpdate

Signal that is emitted when progress has changed (PSSignal).

resume() → bool[source]

Resume the current process.

run()[source]

Run worker in background process.

setLibs(libs: list)[source]

Pass libs to be made available inside the background process.

setName(name: str)[source]

Set the name of the worker.

setPath(path: str)[source]

Set the worker file path.

stop() → bool[source]

Terminate the current process.