Class ContainerManager


  • @NotThreadSafe
    public final class ContainerManager
    extends java.lang.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 Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void onContainerAllocated​(java.lang.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.
      ResourceSpecification onContainerFailed​(java.lang.String failedEvaluatorId)
      Re-acquire a new container using the failed container's resource spec.
      java.util.Optional<ExecutorRepresenter> onContainerLaunched​(org.apache.reef.driver.context.ActiveContext activeContext)
      Initializes master's connection to the container once launched.
      void requestContainer​(int numToRequest, ResourceSpecification resourceSpecification)
      Requests containers/evaluators with the given specifications.
      void terminate()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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​(java.lang.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 java.util.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​(java.lang.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()