Interface WorkerRegistry
-
public interface WorkerRegistry
Registry repository of task reactor workers.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static WorkerRegistry
getInstance(Session session, Identifier schema)
Returns a new instance of the default repository implementation.int
getWorkerCountWithStatuses(WorkerLifecycleStatus... statuses)
Fetches amount of workers with given states.List<WorkerId>
getWorkerIds(WorkerLifecycleStatus... statuses)
Fetches workers which are in given status.void
insertWorkers(int workersToInsert)
Requests given amount of workers to be created.void
setWorkersStatus(WorkerLifecycleStatus status, List<WorkerId> workerIds)
Changes status of workers to provided one.long
updateWorkersStatus(WorkerLifecycleStatus newStatus, WorkerLifecycleStatus currentStatus, Collection<WorkerId> workerIds)
Changes workers status to new one on condition that they are currently in given status.
-
-
-
Method Detail
-
insertWorkers
void insertWorkers(int workersToInsert)
Requests given amount of workers to be created.- Parameters:
workersToInsert
- numbers of workers to be created.
-
setWorkersStatus
void setWorkersStatus(WorkerLifecycleStatus status, List<WorkerId> workerIds)
Changes status of workers to provided one.- Parameters:
status
- new status of workersworkerIds
- workers identifiers
-
updateWorkersStatus
long updateWorkersStatus(WorkerLifecycleStatus newStatus, WorkerLifecycleStatus currentStatus, Collection<WorkerId> workerIds)
Changes workers status to new one on condition that they are currently in given status.- Parameters:
newStatus
- status to be changed tocurrentStatus
- current statusworkerIds
- worker identifiers- Returns:
- count of worker statuses modified
-
getWorkerIds
List<WorkerId> getWorkerIds(WorkerLifecycleStatus... statuses)
Fetches workers which are in given status.- Parameters:
statuses
- collection of statuses- Returns:
- Worker identifiers
-
getWorkerCountWithStatuses
int getWorkerCountWithStatuses(WorkerLifecycleStatus... statuses)
Fetches amount of workers with given states.- Parameters:
statuses
- collection of statuses- Returns:
- Count of workers in given statuses
-
getInstance
static WorkerRegistry getInstance(Session session, Identifier schema)
Returns a new instance of the default repository implementation.Default implementation of the repository uses:
- a default implementation of
DefaultWorkerRegistry
, created for the<schema>.WORKER_REGISTRY
table.
- Parameters:
session
- Snowpark session objectschema
- Schema of the Task Reactor- Returns:
- a new repository instance
- a default implementation of
-
-