Class DefaultExecutorRepresenter

  • All Implemented Interfaces:
    ExecutorRepresenter

    @NotThreadSafe
    public final class DefaultExecutorRepresenter
    extends java.lang.Object
    implements ExecutorRepresenter
    (WARNING) This class is not thread-safe, and thus should only be accessed through ExecutorRegistry.

    Implements ExecutorRepresenter that communicates with Executors running on traditional resources (e.g., virtual machines or cluster resources).

    • Constructor Detail

      • DefaultExecutorRepresenter

        public DefaultExecutorRepresenter​(java.lang.String executorId,
                                          ResourceSpecification resourceSpecification,
                                          MessageSender<ControlMessage.Message> messageSender,
                                          org.apache.reef.driver.context.ActiveContext activeContext,
                                          java.util.concurrent.ExecutorService serializationExecutorService,
                                          java.lang.String nodeName)
        Creates a reference to the specified executor.
        Parameters:
        executorId - the executor id
        resourceSpecification - specification for the executor
        messageSender - provides communication context for this executor
        activeContext - context on the corresponding REEF evaluator
        serializationExecutorService - provides threads for message serialization
        nodeName - physical name of the node where this executor resides
    • Method Detail

      • onExecutorFailed

        public java.util.Set<java.lang.String> onExecutorFailed()
        Marks all Tasks which were running in this executor as failed.
        Specified by:
        onExecutorFailed in interface ExecutorRepresenter
        Returns:
        set of identifiers of tasks that were running in this executor.
      • onTaskScheduled

        public void onTaskScheduled​(Task task)
        Marks the Task as running, and sends scheduling message to the executor.
        Specified by:
        onTaskScheduled in interface ExecutorRepresenter
        Parameters:
        task - the task to run
      • onTaskExecutionComplete

        public void onTaskExecutionComplete​(java.lang.String taskId)
        Marks the specified Task as completed.
        Specified by:
        onTaskExecutionComplete in interface ExecutorRepresenter
        Parameters:
        taskId - id of the completed task
      • onTaskExecutionFailed

        public void onTaskExecutionFailed​(java.lang.String taskId)
        Marks the specified Task as failed.
        Specified by:
        onTaskExecutionFailed in interface ExecutorRepresenter
        Parameters:
        taskId - id of the Task
      • getRunningTasks

        public java.util.Set<Task> getRunningTasks()
        Specified by:
        getRunningTasks in interface ExecutorRepresenter
        Returns:
        the current snapshot of set of Tasks that are running in this executor.
      • getNodeName

        public java.lang.String getNodeName()
        Specified by:
        getNodeName in interface ExecutorRepresenter
        Returns:
        physical name of the node where this executor resides
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object