orxtra v0.13.0 /worker.src.orxtra.worker._registry
On this page

WorkerRegistry tracks connected workers in memory and enforces one worker per project root, providing cross-process write safety by assignment; raises WorkerConflictError on a competing registration.

#worker.src.orxtra.worker._registry

#worker.src.orxtra.worker._registry

Worker registry: tracks connected workers and enforces one-per-root.

Each worker registers with a project root. Only one worker may be registered per root at a time. This constraint provides cross-process write safety by assignment -- workers run their own WriteQueue and StaleWriteTracker locally, and the one-worker-per-root rule prevents conflicting writes without distributed locking.

#WorkerConflictError

Raised when a second worker tries to register for the same root.

#WorkerInfo

State for a single connected worker.

#WorkerRegistry

In-memory registry of connected workers.

Enforces the one-worker-per-root constraint and provides lookup by worker ID or project root.

#register

python
def register(self, consumer_id: UUID | None, root: str, capabilities: list[ToolCapability], bridge: BrainWorkerBridge) -> UUID

Register a new worker. Returns the assigned worker ID.

Raises WorkerConflictError if a worker is already registered for the given root.

#unregister

python
def unregister(self, worker_id: UUID) -> None

Remove a worker from the registry.

#get_worker

python
def get_worker(self, worker_id: UUID) -> WorkerInfo | None

Look up a worker by ID.

#get_worker_for_root

python
def get_worker_for_root(self, root: str) -> WorkerInfo | None

Look up the worker registered for a project root.

#assign_task

python
def assign_task(self, worker_id: UUID, task_id: UUID) -> None

Record that a task is assigned to a worker.

#unassign_task

python
def unassign_task(self, worker_id: UUID, task_id: UUID) -> None

Remove a task assignment from a worker.

#worker_count

python
def worker_count(self) -> int

#list_workers

python
def list_workers(self) -> list[WorkerInfo]
Search