Class ContainerManager


  • @NotThreadSafe
    public final class ContainerManager
    extends Object
    (WARNING) This class is not thread-safe. Only a single thread should use the methods of this class. (i.e., runtimeMasterThread in RuntimeMaster)

    Encapsulates REEF's evaluator management for containers. Serves as a single point of container management in Runtime. We define a unit of resource a container (an evaluator in REEF), and launch a single executor on each container.

    • Method Detail

      • requestContainer

        public void requestContainer​(int numToRequest,
                                     ResourceSpecification resourceSpecification)
        Requests containers/evaluators with the given specifications.
        Parameters:
        numToRequest - number of containers to request
        resourceSpecification - containing the specifications of
      • onContainerAllocated

        public void onContainerAllocated​(String executorId,
                                         org.apache.reef.driver.evaluator.AllocatedEvaluator allocatedContainer,
                                         org.apache.reef.tang.Configuration executorConfiguration)
        Take the necessary actions in container manager once a container a is allocated.
        Parameters:
        executorId - of the executor to launch on this container.
        allocatedContainer - the allocated container.
        executorConfiguration - executor related configuration.
      • onContainerLaunched

        public Optional<ExecutorRepresenter> onContainerLaunched​(org.apache.reef.driver.context.ActiveContext activeContext)
        Initializes master's connection to the container once launched. A representation of the executor to reside in master is created.
        Parameters:
        activeContext - for the launched container.
        Returns:
        a representation of the executor. (return an empty Optional if terminated)
      • onContainerFailed

        public ResourceSpecification onContainerFailed​(String failedEvaluatorId)
        Re-acquire a new container using the failed container's resource spec.
        Parameters:
        failedEvaluatorId - of the failed evaluator
        Returns:
        the resource specification of the failed evaluator
      • terminate

        public void terminate()