Interface WorkerRegistry


  • public interface WorkerRegistry
    Registry repository of task reactor workers.
    • 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 workers
        workerIds - 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 to
        currentStatus - current status
        workerIds - 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 object
        schema - Schema of the Task Reactor
        Returns:
        a new repository instance