worker_plugins

class pyrosetta.distributed.cluster.worker_plugins.SocketLoggerPlugin(logging_level: str, maxsize: int = 128)

Bases: WorkerPlugin

Install a MultiSocketHandler logging handler on a Dask worker logger.

__init__(logging_level: str, maxsize: int = 128) None

Initialize the SocketLoggerPlugin Dask worker plugin.

setup(worker: Worker) None

Setup the SocketLoggerPlugin Dask worker plugin.

teardown(worker: Worker) None

Teardown the SocketLoggerPlugin Dask worker plugin.

idempotent: bool = False
transition(key: Key, start: WorkerTaskStateState, finish: WorkerTaskStateState, **kwargs: Any) None

Throughout the lifecycle of a task (see Worker State), Workers are instructed by the scheduler to compute certain tasks, resulting in transitions in the state of each task. The Worker owning the task is then notified of this state transition.

Whenever a task changes its state, this method will be called.

Warning

This is an advanced feature and the transition mechanism and details of task states are subject to change without deprecation cycle.

key : start :

Start state of the transition. One of waiting, ready, executing, long-running, memory, error.

finish :

Final state of the transition.

kwargs :

More options passed when transitioning

class pyrosetta.distributed.cluster.worker_plugins.TaskSecurityPlugin(instance_id: str, prk: MaskedBytes, max_nonce: int)

Bases: WorkerPlugin, NonceCache

Install a secure NonceCache instance with replay protection on a Dask worker.

__init__(instance_id: str, prk: MaskedBytes, max_nonce: int) None

Initialize the TaskSecurityPlugin Dask worker plugin.

setup(worker: Worker) None

Setup the TaskSecurityPlugin Dask worker plugin.

teardown(worker: Worker) None

Teardown the TaskSecurityPlugin Dask worker plugin.

_cache_nonce(sealed: bytes) None

Run Hash-based Message Authentication Code (HMAC) verification and cache nonces for replay protection without data decompression.

static _get_state(self) Dict[str, Any]

A method used to override the default NonceCache.__getstate__() method that sets the value of the the ‘prk’ key (i.e., the pseudorandom key (PRK)) to None in the returned state.

static _on_worker() bool

Test if the nonce cache is on a Dask worker.

idempotent: bool = False
transition(key: Key, start: WorkerTaskStateState, finish: WorkerTaskStateState, **kwargs: Any) None

Throughout the lifecycle of a task (see Worker State), Workers are instructed by the scheduler to compute certain tasks, resulting in transitions in the state of each task. The Worker owning the task is then notified of this state transition.

Whenever a task changes its state, this method will be called.

Warning

This is an advanced feature and the transition mechanism and details of task states are subject to change without deprecation cycle.

key : start :

Start state of the transition. One of waiting, ready, executing, long-running, memory, error.

finish :

Final state of the transition.

kwargs :

More options passed when transitioning

instance_id: str
prk: Optional[bytes]
max_nonce: int
_seen: AbstractSet
_order: Deque[bytes]
_debug: bool