public class DefaultScheduler extends Object implements InstanceListener, JobStatusListener, ExecutionStageListener
JobManager is responsible for requesting the required instances for the
job at the InstanceManager, the scheduler is in charge of assigning the
individual tasks to the instances.| Modifier and Type | Field and Description |
|---|---|
protected static org.apache.commons.logging.Log |
LOG
The LOG object to report events within the scheduler.
|
| Constructor and Description |
|---|
DefaultScheduler(DeploymentManager deploymentManager,
InstanceManager instanceManager)
Constructs a new abstract scheduler.
|
| Modifier and Type | Method and Description |
|---|---|
void |
allocatedResourcesDied(JobID jobID,
List<AllocatedResource> allocatedResources)
Called if one or more allocated resources assigned to at least one job have died unexpectedly.
|
void |
checkAndReleaseAllocatedResource(ExecutionGraph executionGraph,
AllocatedResource allocatedResource)
Checks if the given
AllocatedResource is still required for the
execution of the given execution graph. |
void |
deployAssignedInputVertices(ExecutionGraph executionGraph)
Collects all execution vertices with the state ASSIGNED starting from the input vertices of the current execution
stage and deploys them on the assigned
AllocatedResource objects. |
void |
deployAssignedPipeline(ExecutionPipeline pipeline)
Collects all execution vertices with the state ASSIGNED from the given pipeline and deploys them on the assigned
AllocatedResource objects. |
void |
deployAssignedVertices(Collection<ExecutionVertex> startVertices)
Collects all execution vertices with the state ASSIGNED starting from the given collection of start vertices and
deploys them on the assigned
AllocatedResource objects. |
void |
deployAssignedVertices(ExecutionVertex startVertex)
Collects all execution vertices with the state ASSIGNED starting from the given start vertex and
deploys them on the assigned
AllocatedResource objects. |
ExecutionGraph |
getExecutionGraphByID(JobID jobID)
Returns the execution graph which is associated with the given job ID.
|
InstanceManager |
getInstanceManager()
Returns the
InstanceManager object which is used by the current scheduler. |
void |
jobStatusHasChanged(ExecutionGraph executionGraph,
InternalJobStatus newJobStatus,
String optionalMessage)
Called when the status of the job with the given {@li
|
void |
nextExecutionStageEntered(JobID jobID,
ExecutionStage executionStage)
This method is called to indicate that the job with the given
JobID has finished its previous
ExecutionStage and has entered the next ExecutionStage. |
protected void |
replayCheckpointsFromPreviousStage(ExecutionGraph executionGraph) |
protected void |
requestInstances(ExecutionStage executionStage)
Collects the instances required to run the job from the given
ExecutionStage and requests them at the
loaded instance manager. |
void |
resourcesAllocated(JobID jobID,
List<AllocatedResource> allocatedResources)
Called if one or more requested resources have become available.
|
void |
scheduleJob(ExecutionGraph executionGraph)
Adds a job represented by an
ExecutionGraph object to the scheduler. |
void |
shutdown()
Shuts the scheduler down.
|
protected static final org.apache.commons.logging.Log LOG
public DefaultScheduler(DeploymentManager deploymentManager, InstanceManager instanceManager)
deploymentManager - the deployment manager assigned to this schedulerinstanceManager - the instance manager to be used with this schedulerpublic void scheduleJob(ExecutionGraph executionGraph) throws SchedulingException
ExecutionGraph object to the scheduler. The job is then executed according
to the strategies of the concrete scheduler implementation.executionGraph - the job to be added to the schedulerSchedulingException - thrown if an error occurs and the scheduler does not accept the new jobpublic ExecutionGraph getExecutionGraphByID(JobID jobID)
jobID - the job ID to search the execution graph fornullpublic void shutdown()
public void jobStatusHasChanged(ExecutionGraph executionGraph, InternalJobStatus newJobStatus, String optionalMessage)
JobStatusListenerjobStatusHasChanged in interface JobStatusListenerexecutionGraph - the executionGraph representing the job the event belongs tonewJobStatus - the new job statusoptionalMessage - an optional message (possibly null) that can be attached to the state changepublic void nextExecutionStageEntered(JobID jobID, ExecutionStage executionStage)
ExecutionStageListenerJobID has finished its previous
ExecutionStage and has entered the next ExecutionStage. Note that a notification is not sent when
the job has entered its initial execution stage.nextExecutionStageEntered in interface ExecutionStageListenerjobID - the ID of the job the notification belongs toexecutionStage - the next execution stage that has just been enteredpublic InstanceManager getInstanceManager()
InstanceManager object which is used by the current scheduler.InstanceManager object which is used by the current schedulerprotected void requestInstances(ExecutionStage executionStage) throws InstanceException
ExecutionStage and requests them at the
loaded instance manager.executionStage - the execution stage to collect the required instances fromInstanceException - thrown if the given execution graph is already processing its final stagepublic void deployAssignedVertices(ExecutionVertex startVertex)
AllocatedResource objects.startVertex - the execution vertex to start the deployment frompublic void deployAssignedPipeline(ExecutionPipeline pipeline)
AllocatedResource objects.pipeline - the execution pipeline to be deployedpublic void deployAssignedVertices(Collection<ExecutionVertex> startVertices)
AllocatedResource objects.startVertices - the collection of execution vertices to start the deployment frompublic void deployAssignedInputVertices(ExecutionGraph executionGraph)
AllocatedResource objects.executionGraph - the execution graph to collect the vertices frompublic void resourcesAllocated(JobID jobID, List<AllocatedResource> allocatedResources)
InstanceListenerresourcesAllocated in interface InstanceListenerjobID - the ID of the job the initial request has been triggered forallocatedResources - the resources which have been allocated as a response to the initial requestpublic void checkAndReleaseAllocatedResource(ExecutionGraph executionGraph, AllocatedResource allocatedResource)
AllocatedResource is still required for the
execution of the given execution graph. If the resource is no longer
assigned to a vertex that is either currently running or about to run
the given resource is returned to the instance manager for deallocation.executionGraph - the execution graph the provided resource has been used for so farallocatedResource - the allocated resource to check the assignment forprotected void replayCheckpointsFromPreviousStage(ExecutionGraph executionGraph)
public void allocatedResourcesDied(JobID jobID, List<AllocatedResource> allocatedResources)
InstanceListenerallocatedResourcesDied in interface InstanceListenerjobID - the ID of the job the instance is used forallocatedResources - the allocated resources which are affected by the instance deathCopyright © 2014 The Apache Software Foundation. All rights reserved.