Class DefaultExecutorRepresenter
- java.lang.Object
-
- org.apache.nemo.runtime.master.resource.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 Summary
Constructors Constructor Description 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getContainerType()
int
getExecutorCapacity()
java.lang.String
getExecutorId()
java.lang.String
getNodeName()
int
getNumOfComplyingRunningTasks()
int
getNumOfRunningTasks()
java.util.Set<Task>
getRunningTasks()
java.util.Set<java.lang.String>
onExecutorFailed()
Marks all Tasks which were running in this executor as failed.void
onTaskExecutionComplete(java.lang.String taskId)
Marks the specified Task as completed.void
onTaskExecutionFailed(java.lang.String taskId)
Marks the specified Task as failed.void
onTaskScheduled(Task task)
Marks the Task as running, and sends scheduling message to the executor.void
sendControlMessage(ControlMessage.Message message)
Sends control message to the executor.void
shutDown()
Shuts down this executor.java.lang.String
toString()
-
-
-
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 idresourceSpecification
- specification for the executormessageSender
- provides communication context for this executoractiveContext
- context on the corresponding REEF evaluatorserializationExecutorService
- provides threads for message serializationnodeName
- 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 interfaceExecutorRepresenter
- 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 interfaceExecutorRepresenter
- Parameters:
task
- the task to run
-
sendControlMessage
public void sendControlMessage(ControlMessage.Message message)
Sends control message to the executor.- Specified by:
sendControlMessage
in interfaceExecutorRepresenter
- Parameters:
message
- Message object to send
-
onTaskExecutionComplete
public void onTaskExecutionComplete(java.lang.String taskId)
Marks the specified Task as completed.- Specified by:
onTaskExecutionComplete
in interfaceExecutorRepresenter
- 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 interfaceExecutorRepresenter
- Parameters:
taskId
- id of the Task
-
getExecutorCapacity
public int getExecutorCapacity()
- Specified by:
getExecutorCapacity
in interfaceExecutorRepresenter
- Returns:
- how many Tasks can this executor simultaneously run
-
getRunningTasks
public java.util.Set<Task> getRunningTasks()
- Specified by:
getRunningTasks
in interfaceExecutorRepresenter
- Returns:
- the current snapshot of set of Tasks that are running in this executor.
-
getNumOfRunningTasks
public int getNumOfRunningTasks()
- Specified by:
getNumOfRunningTasks
in interfaceExecutorRepresenter
- Returns:
- the number of running
Task
s.
-
getNumOfComplyingRunningTasks
public int getNumOfComplyingRunningTasks()
- Specified by:
getNumOfComplyingRunningTasks
in interfaceExecutorRepresenter
- Returns:
- the number of running
Task
s that complies to the executor slot restriction.
-
getExecutorId
public java.lang.String getExecutorId()
- Specified by:
getExecutorId
in interfaceExecutorRepresenter
- Returns:
- the executor id
-
getContainerType
public java.lang.String getContainerType()
- Specified by:
getContainerType
in interfaceExecutorRepresenter
- Returns:
- the container type
-
getNodeName
public java.lang.String getNodeName()
- Specified by:
getNodeName
in interfaceExecutorRepresenter
- Returns:
- physical name of the node where this executor resides
-
shutDown
public void shutDown()
Shuts down this executor.- Specified by:
shutDown
in interfaceExecutorRepresenter
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-