@InterfaceAudience.Public @InterfaceStability.Unstable public abstract class TaskScheduler extends Object implements org.apache.tez.common.ServicePluginLifecycle
TaskSchedulerContext
- which provides
a mechanism to notify the system about allocation decisions and resources to the Tez framework.Constructor and Description |
---|
TaskScheduler(TaskSchedulerContext taskSchedulerContext) |
Modifier and Type | Method and Description |
---|---|
abstract void |
allocateTask(Object task,
org.apache.hadoop.yarn.api.records.Resource capability,
org.apache.hadoop.yarn.api.records.ContainerId containerId,
org.apache.hadoop.yarn.api.records.Priority priority,
Object containerSignature,
Object clientCookie)
A request to the source to allocate resources for a requesting task, based on a previously used
container
|
abstract void |
allocateTask(Object task,
org.apache.hadoop.yarn.api.records.Resource capability,
String[] hosts,
String[] racks,
org.apache.hadoop.yarn.api.records.Priority priority,
Object containerSignature,
Object clientCookie)
A request to the source to allocate resources for a requesting task, with location information
optionally specified
|
abstract void |
blacklistNode(org.apache.hadoop.yarn.api.records.NodeId nodeId)
Indication to a source that a node has been blacklisted, and should not be used for subsequent
allocations.
|
abstract void |
dagComplete()
Indicates to the scheduler that the currently running dag has completed.
|
abstract Object |
deallocateContainer(org.apache.hadoop.yarn.api.records.ContainerId containerId)
A request to de-allocate a previously allocated container.
|
abstract boolean |
deallocateTask(Object task,
boolean taskSucceeded,
TaskAttemptEndReason endReason,
String diagnostics)
A request to deallocate a task.
|
abstract org.apache.hadoop.yarn.api.records.Resource |
getAvailableResources()
Get the currently available resources from this source
|
abstract int |
getClusterNodeCount()
Get the number of nodes available from the source
|
TaskSchedulerContext |
getContext()
Get the
TaskSchedulerContext associated with this instance of the scheduler, which is
used to communicate with the rest of the system |
int |
getHeldContainersCount()
Get the number of held containers.
|
abstract org.apache.hadoop.yarn.api.records.Resource |
getTotalResources()
Get the total available resources from this source
|
abstract boolean |
hasUnregistered()
Checks with the scheduler whether it has unregistered.
|
void |
initialize()
An entry point for initialization.
|
void |
initiateStop()
The first step of stopping the task scheduler service.
|
protected void |
onContainersAllocated(List<org.apache.hadoop.yarn.api.records.Container> containers)
Callback to be used in the event of a container allocation.
|
abstract void |
setShouldUnregister()
Inform the scheduler that it should unregister.
|
void |
shutdown()
Stop the service.
|
void |
start()
An entry point for starting the service.
|
void |
taskStateUpdated(Object task,
org.apache.tez.serviceplugins.api.TaskScheduler.SchedulerTaskState state)
Information about the state of a previously allocated task.
|
abstract void |
unblacklistNode(org.apache.hadoop.yarn.api.records.NodeId nodeId)
Indication to a source that a node has been un-blacklisted, and can be used from subsequent
allocations
|
public TaskScheduler(TaskSchedulerContext taskSchedulerContext)
public void initialize() throws Exception
initialize
in interface org.apache.tez.common.ServicePluginLifecycle
Exception
public void start() throws Exception
start
in interface org.apache.tez.common.ServicePluginLifecycle
Exception
public void shutdown() throws Exception
shutdown
in interface org.apache.tez.common.ServicePluginLifecycle
Exception
public void initiateStop()
public final TaskSchedulerContext getContext()
TaskSchedulerContext
associated with this instance of the scheduler, which is
used to communicate with the rest of the systemTaskSchedulerContext
public abstract org.apache.hadoop.yarn.api.records.Resource getAvailableResources() throws org.apache.tez.serviceplugins.api.ServicePluginException
org.apache.tez.serviceplugins.api.ServicePluginException
- when the service runs into a fatal error which it cannot handle.
This will cause the app to shutdown.public abstract org.apache.hadoop.yarn.api.records.Resource getTotalResources() throws org.apache.tez.serviceplugins.api.ServicePluginException
org.apache.tez.serviceplugins.api.ServicePluginException
- when the service runs into a fatal error which it cannot handle.
This will cause the app to shutdown.public abstract int getClusterNodeCount() throws org.apache.tez.serviceplugins.api.ServicePluginException
org.apache.tez.serviceplugins.api.ServicePluginException
- when the service runs into a fatal error which it cannot handle.
This will cause the app to shutdown.public abstract void blacklistNode(org.apache.hadoop.yarn.api.records.NodeId nodeId) throws org.apache.tez.serviceplugins.api.ServicePluginException
nodeId
- te nodeId to be blacklistedorg.apache.tez.serviceplugins.api.ServicePluginException
- when the service runs into a fatal error which it cannot handle.
This will cause the app to shutdown.public abstract void unblacklistNode(org.apache.hadoop.yarn.api.records.NodeId nodeId) throws org.apache.tez.serviceplugins.api.ServicePluginException
nodeId
- the nodeId to be unblacklistedorg.apache.tez.serviceplugins.api.ServicePluginException
- when the service runs into a fatal error which it cannot handle.
This will cause the app to shutdown.public abstract void allocateTask(Object task, org.apache.hadoop.yarn.api.records.Resource capability, String[] hosts, String[] racks, org.apache.hadoop.yarn.api.records.Priority priority, Object containerSignature, Object clientCookie) throws org.apache.tez.serviceplugins.api.ServicePluginException
task
- the task for which resources are being accepted.capability
- the required resources to run this taskhosts
- the preferred host locations for the taskracks
- the preferred rack locations for the taskpriority
- the priority of the request for this allocation. A lower value
implies a higher prioritycontainerSignature
- the specifications for the container (environment, etc) which will
be
used for this task - if applicableclientCookie
- a cookie associated with this request. This should be returned back
via the TaskSchedulerContext.taskAllocated(Object, Object,
Container)
method when a task is assigned to a resourceorg.apache.tez.serviceplugins.api.ServicePluginException
- when the service runs into a fatal error which it cannot handle.
This will cause the app to shutdown.public abstract void allocateTask(Object task, org.apache.hadoop.yarn.api.records.Resource capability, org.apache.hadoop.yarn.api.records.ContainerId containerId, org.apache.hadoop.yarn.api.records.Priority priority, Object containerSignature, Object clientCookie) throws org.apache.tez.serviceplugins.api.ServicePluginException
task
- the task for which resources are being accepted.capability
- the required resources to run this taskcontainerId
- a previous container which is used as an indication as to where this
task should be placedpriority
- the priority of the request for this allocation. A lower value
implies a higher prioritycontainerSignature
- the specifications for the container (environment, etc) which will
be
used for this task - if applicableclientCookie
- a cookie associated with this request. This should be returned back
via the TaskSchedulerContext.taskAllocated(Object, Object,
Container)
method when a task is assigned to a resourceorg.apache.tez.serviceplugins.api.ServicePluginException
- when the service runs into a fatal error which it cannot handle.
This will cause the app to shutdown.public void taskStateUpdated(Object task, org.apache.tez.serviceplugins.api.TaskScheduler.SchedulerTaskState state) throws org.apache.tez.serviceplugins.api.ServicePluginException
task
- the task for which an update is being providedstate
- the updated stateorg.apache.tez.serviceplugins.api.ServicePluginException
public abstract boolean deallocateTask(Object task, boolean taskSucceeded, TaskAttemptEndReason endReason, @Nullable String diagnostics) throws org.apache.tez.serviceplugins.api.ServicePluginException
task
- the task being de-allocated.taskSucceeded
- whether the task succeeded or notendReason
- the reason for the task failurediagnostics
- additional diagnostics information which may be relevantorg.apache.tez.serviceplugins.api.ServicePluginException
- when the service runs into a fatal error which it cannot handle.
This will cause the app to shutdown.
with a containerpublic abstract Object deallocateContainer(org.apache.hadoop.yarn.api.records.ContainerId containerId) throws org.apache.tez.serviceplugins.api.ServicePluginException
containerId
- the containerId to de-allocateorg.apache.tez.serviceplugins.api.ServicePluginException
- when the service runs into a fatal error which it cannot handle.
This will cause the app to shutdown.public abstract void setShouldUnregister() throws org.apache.tez.serviceplugins.api.ServicePluginException
org.apache.tez.serviceplugins.api.ServicePluginException
- when the service runs into a fatal error which it cannot handle.
This will cause the app to shutdown.public abstract boolean hasUnregistered() throws org.apache.tez.serviceplugins.api.ServicePluginException
org.apache.tez.serviceplugins.api.ServicePluginException
- when the service runs into a fatal error which it cannot handle.
This will cause the app to shutdown.public abstract void dagComplete() throws org.apache.tez.serviceplugins.api.ServicePluginException
org.apache.tez.serviceplugins.api.ServicePluginException
- when the service runs into a fatal error which it cannot handle.
This will cause the app to shutdown.public int getHeldContainersCount()
protected void onContainersAllocated(List<org.apache.hadoop.yarn.api.records.Container> containers)
Copyright © 2024 Apache Software Foundation. All rights reserved.