public class ExecutionGraph extends Object implements ExecutionListener
This class is thread-safe.
| Constructor and Description |
|---|
ExecutionGraph(JobGraph job,
int defaultParallelism)
Creates a new execution graph from a job graph.
|
| Modifier and Type | Method and Description |
|---|---|
void |
executeCommand(Runnable command)
Performs an asynchronous update operation to this execution graph.
|
void |
executionStateChanged(JobID jobID,
ExecutionVertexID vertexID,
ExecutionState newExecutionState,
String optionalMessage)
Called when the execution state of the associated task has changed.
|
ChannelType |
getChannelType(ExecutionVertex sourceVertex,
ExecutionVertex targetVertex) |
ExecutionStage |
getCurrentExecutionStage()
Returns the stage which is currently executed.
|
ExecutionEdge |
getEdgeByID(ChannelID id)
Finds an
ExecutionEdge by its ID and returns it. |
int |
getIndexOfCurrentExecutionStage()
Returns the index of the current execution stage.
|
ExecutionVertex |
getInputVertex(int index)
Returns the input vertex with the specified index.
|
ExecutionVertex |
getInputVertex(int stage,
int index)
Returns the input vertex with the specified index for the given stage
|
Configuration |
getJobConfiguration()
Returns the job configuration that was originally attached to the job graph.
|
JobID |
getJobID()
Returns the job ID of the job configuration this execution graph was originally constructed from.
|
String |
getJobName()
Returns the name of the original job graph.
|
InternalJobStatus |
getJobStatus()
Returns the current status of the job
represented by this execution graph.
|
int |
getNumberOfInputVertices()
Returns the number of input vertices registered with this execution graph.
|
int |
getNumberOfInputVertices(int stage)
Returns the number of input vertices for the given stage.
|
int |
getNumberOfOutputVertices()
Returns the number of output vertices registered with this execution graph.
|
int |
getNumberOfOutputVertices(int stage)
Returns the number of output vertices for the given stage.
|
int |
getNumberOfStages()
Returns the number of execution stages in the execution graph.
|
ExecutionVertex |
getOutputVertex(int index)
Returns the output vertex with the specified index.
|
ExecutionVertex |
getOutputVertex(int stage,
int index)
Returns the output vertex with the specified index for the given stage.
|
int |
getPriority()
Returns the priority of the execution listener object.
|
int |
getRequiredSlots()
Retrieves the number of required slots to run this execution graph
|
ExecutionStage |
getStage(int num)
Returns the execution stage with number
num. |
ExecutionVertex |
getVertexByChannelID(ChannelID id)
Identifies an execution by the specified channel ID and returns it.
|
ExecutionVertex |
getVertexByID(ExecutionVertexID id)
Returns the execution vertex with the given vertex ID.
|
boolean |
isExecutionFinished()
Checks if the execution of execution graph is finished.
|
Iterator<ExecutionStage> |
iterator()
Returns an iterator over all execution stages contained in this graph.
|
void |
registerExecutionStageListener(ExecutionStageListener executionStageListener)
Registers a new
ExecutionStageListener object with this execution graph. |
void |
registerJobStatusListener(JobStatusListener jobStatusListener)
Registers a new
JobStatusListener object with this execution graph. |
void |
repairInstanceAssignment() |
void |
repairInstanceSharing() |
void |
repairStages() |
void |
unregisterExecutionStageListener(ExecutionStageListener executionStageListener)
Unregisters the given
ExecutionStageListener object. |
void |
unregisterJobStatusListener(JobStatusListener jobStatusListener)
Unregisters the given
JobStatusListener object. |
void |
updateJobStatus(InternalJobStatus newJobStatus,
String optionalMessage)
Updates the job status to given status and triggers the execution of the
JobStatusListener objects. |
void |
userThreadFinished(JobID jobID,
ExecutionVertexID vertexID,
Thread userThread)
Called when a thread spawn by a user task has finished.
|
void |
userThreadStarted(JobID jobID,
ExecutionVertexID vertexID,
Thread userThread)
Called when the user task has started a new thread.
|
public ExecutionGraph(JobGraph job, int defaultParallelism) throws GraphConversionException
job - the user's job graphdefaultParallelism - defaultParallelism in case that nodes have no parallelism setGraphConversionException - thrown if the job graph is not valid and no execution graph can be constructed from itpublic int getNumberOfInputVertices()
public int getNumberOfInputVertices(int stage)
stage - the index of the execution stagepublic int getNumberOfOutputVertices()
public int getNumberOfOutputVertices(int stage)
stage - the index of the execution stagepublic ExecutionVertex getInputVertex(int index)
index - the index of the input vertex to returnnull if no input vertex with such an index
existspublic ExecutionVertex getOutputVertex(int index)
index - the index of the output vertex to returnnull if no output vertex with such an index
existspublic ExecutionVertex getInputVertex(int stage, int index)
stage - the index of the stageindex - the index of the input vertex to returnnull if no input vertex with such an index
exists in that stagepublic ExecutionVertex getOutputVertex(int stage, int index)
stage - the index of the stageindex - the index of the output vertex to returnnull if no output vertex with such an index
exists in that stagepublic ExecutionStage getStage(int num)
num.num - the number of the execution stage to be returnednum or null if no such execution stage existspublic int getNumberOfStages()
public ExecutionVertex getVertexByChannelID(ChannelID id)
id - the channel ID to identify the vertex withid or null if no such vertex
exists in the execution graphpublic ExecutionEdge getEdgeByID(ChannelID id)
ExecutionEdge by its ID and returns it.id - the channel ID to identify the edgeid or null if no such edge is knownpublic ExecutionVertex getVertexByID(ExecutionVertexID id)
id - the vertex ID to retrieve the execution vertexnull if no such vertex could be
foundpublic boolean isExecutionFinished()
true if the execution of the graph is finished, false otherwisepublic JobID getJobID()
public int getIndexOfCurrentExecutionStage()
public ExecutionStage getCurrentExecutionStage()
null if the job execution is already completedpublic void repairStages()
public void repairInstanceSharing()
public void repairInstanceAssignment()
public ChannelType getChannelType(ExecutionVertex sourceVertex, ExecutionVertex targetVertex)
public Configuration getJobConfiguration()
public InternalJobStatus getJobStatus()
public void executionStateChanged(JobID jobID, ExecutionVertexID vertexID, ExecutionState newExecutionState, String optionalMessage)
ExecutionListenernewExecutionState may be out-dated by the time a particular execution listener is called.
To determine the most recent state of the respective task, it is recommended to store a reference on the
execution that represents it and then call getExecutionState() on the vertex within this method.executionStateChanged in interface ExecutionListenerjobID - the ID of the job the task belongs tovertexID - the ID of the task whose state has changednewExecutionState - the execution state the task has just switched tooptionalMessage - an optional message providing further information on the state changepublic void updateJobStatus(InternalJobStatus newJobStatus, String optionalMessage)
JobStatusListener objects.newJobStatus - the new job statusoptionalMessage - an optional message providing details on the reasons for the state changepublic void registerJobStatusListener(JobStatusListener jobStatusListener)
JobStatusListener object with this execution graph.
After being registered the object will receive notifications about changes
of the job status. It is not possible to register the same listener object
twice.jobStatusListener - the listener object to registerpublic void unregisterJobStatusListener(JobStatusListener jobStatusListener)
JobStatusListener object. After having called this
method, the object will no longer receive notifications about changes of the job
status.jobStatusListener - the listener object to unregisterpublic void registerExecutionStageListener(ExecutionStageListener executionStageListener)
ExecutionStageListener object with this execution graph. After being registered the
object will receive a notification whenever the job has entered its next execution stage. Note that a
notification is not sent when the job has entered its initial execution stage.executionStageListener - the listener object to registerpublic void unregisterExecutionStageListener(ExecutionStageListener executionStageListener)
ExecutionStageListener object. After having called this method, the object will no
longer receiver notifications about the execution stage progress.executionStageListener - the listener object to unregisterpublic String getJobName()
nullpublic void userThreadStarted(JobID jobID, ExecutionVertexID vertexID, Thread userThread)
ExecutionListeneruserThreadStarted in interface ExecutionListenerjobID - the ID of the job the task belongs tovertexID - the ID of the task that started of new threaduserThread - the user thread which has been startedpublic void userThreadFinished(JobID jobID, ExecutionVertexID vertexID, Thread userThread)
ExecutionListeneruserThreadFinished in interface ExecutionListenerjobID - the ID of the job the task belongs tovertexID - the ID of the task whose thread has finisheduserThread - the user thread which has finishedpublic Iterator<ExecutionStage> iterator()
public int getPriority()
ExecutionListenergetPriority in interface ExecutionListenerpublic void executeCommand(Runnable command)
command - the update command to be asynchronously executed on this graphpublic int getRequiredSlots()
Copyright © 2014 The Apache Software Foundation. All rights reserved.