Search in sources :

Example 1 with AMNodeEventNodeCountUpdated

use of org.apache.tez.dag.app.rm.node.AMNodeEventNodeCountUpdated in project tez by apache.

the class TaskSchedulerManager method getProgress.

// Not synchronized to avoid deadlocks from TaskScheduler callbacks.
// TaskScheduler uses a separate thread for it's callbacks. Since this method
// returns a value which is required, the TaskScheduler wait for the call to
// complete and can hence lead to a deadlock if called from within a TSEH lock.
public float getProgress(int schedulerId) {
    // at this point allocate has been called and so node count must be available
    // may change after YARN-1722
    // This is a heartbeat in from the scheduler into the APP, and is being used to piggy-back and
    // node updates from the cluster.
    // Doubles as a mechanism to update node counts periodically. Hence schedulerId required.
    // TODO Handle this in TEZ-2124. Need a way to know which scheduler is calling in.
    int nodeCount = 0;
    try {
        nodeCount = taskSchedulers[0].getClusterNodeCount();
    } catch (Exception e) {
        String msg = "Error in TaskScheduler while getting node count" + ", scheduler=" + Utils.getTaskSchedulerIdentifierString(schedulerId, appContext);
        LOG.error(msg, e);
        sendEvent(new DAGAppMasterEventUserServiceFatalError(DAGAppMasterEventType.TASK_SCHEDULER_SERVICE_FATAL_ERROR, msg, e));
        throw new RuntimeException(e);
    }
    if (nodeCount != cachedNodeCount) {
        cachedNodeCount = nodeCount;
        sendEvent(new AMNodeEventNodeCountUpdated(cachedNodeCount, schedulerId));
    }
    return dagAppMaster.getProgress();
}
Also used : DAGAppMasterEventUserServiceFatalError(org.apache.tez.dag.app.dag.event.DAGAppMasterEventUserServiceFatalError) AMNodeEventNodeCountUpdated(org.apache.tez.dag.app.rm.node.AMNodeEventNodeCountUpdated) TaskLocationHint(org.apache.tez.dag.api.TaskLocationHint) TezUncheckedException(org.apache.tez.dag.api.TezUncheckedException) TezException(org.apache.tez.dag.api.TezException)

Aggregations

TaskLocationHint (org.apache.tez.dag.api.TaskLocationHint)1 TezException (org.apache.tez.dag.api.TezException)1 TezUncheckedException (org.apache.tez.dag.api.TezUncheckedException)1 DAGAppMasterEventUserServiceFatalError (org.apache.tez.dag.app.dag.event.DAGAppMasterEventUserServiceFatalError)1 AMNodeEventNodeCountUpdated (org.apache.tez.dag.app.rm.node.AMNodeEventNodeCountUpdated)1