use of org.apache.tez.dag.app.dag.TaskAttempt in project tez by apache.
the class DAGSchedulerNaturalOrderControlled method scheduleTaskEx.
// TODO Does ordering matter - it currently depends on the order returned by vertex.getOutput*
@Override
public void scheduleTaskEx(DAGEventSchedulerUpdate event) {
TaskAttempt attempt = event.getAttempt();
Vertex vertex = dag.getVertex(attempt.getVertexID());
int vertexDistanceFromRoot = vertex.getDistanceFromRoot();
// natural priority. Handles failures and retries.
int priorityLowLimit = ((vertexDistanceFromRoot + 1) * dag.getTotalVertices() * 3) + (vertex.getVertexId().getId() * 3);
int priorityHighLimit = priorityLowLimit - 2;
TaskAttemptEventSchedule attemptEvent = new TaskAttemptEventSchedule(attempt.getID(), priorityLowLimit, priorityHighLimit);
taskAttemptSeen(vertex.getName(), attempt.getID());
if (vertexAlreadyScheduled(vertex)) {
// Vertex previously marked ready for scheduling.
if (LOG.isDebugEnabled()) {
LOG.debug("Scheduling " + attempt.getID() + " between priorityLow: " + priorityLowLimit + " and priorityHigh: " + priorityHighLimit);
}
sendEvent(attemptEvent);
// A new taks coming in here could send us over the enough tasks scheduled limit.
processDownstreamVertices(vertex);
} else {
if (LOG.isDebugEnabled()) {
LOG.debug("Attempting to schedule vertex: " + vertex.getLogIdentifier() + " due to schedule event");
}
boolean scheduled = trySchedulingVertex(vertex);
if (scheduled) {
LOG.info("Scheduled vertex: " + vertex.getLogIdentifier());
// If ready to be scheduled, send out pending events and the current event.
// Send events out for this vertex first. Then try scheduling downstream vertices.
sendEventsForVertex(vertex.getName());
sendEvent(attemptEvent);
if (LOG.isDebugEnabled()) {
LOG.debug("Processing downstream vertices for vertex: " + vertex.getLogIdentifier());
}
processDownstreamVertices(vertex);
} else {
pendingEvents.put(vertex.getName(), attemptEvent);
}
}
}
use of org.apache.tez.dag.app.dag.TaskAttempt in project tez by apache.
the class DAGSchedulerNaturalOrder method scheduleTaskEx.
@Override
public void scheduleTaskEx(DAGEventSchedulerUpdate event) {
TaskAttempt attempt = event.getAttempt();
Vertex vertex = dag.getVertex(attempt.getVertexID());
int vertexDistanceFromRoot = vertex.getDistanceFromRoot();
// natural priority. Handles failures and retries.
int priorityLowLimit = ((vertexDistanceFromRoot + 1) * dag.getTotalVertices() * 3) + (vertex.getVertexId().getId() * 3);
int priorityHighLimit = priorityLowLimit - 2;
if (LOG.isDebugEnabled()) {
LOG.debug("Scheduling " + attempt.getID() + " between priorityLow: " + priorityLowLimit + " and priorityHigh: " + priorityHighLimit);
}
TaskAttemptEventSchedule attemptEvent = new TaskAttemptEventSchedule(attempt.getID(), priorityLowLimit, priorityHighLimit);
sendEvent(attemptEvent);
}
use of org.apache.tez.dag.app.dag.TaskAttempt in project tez by apache.
the class LegacyTaskRuntimeEstimator method storedPerAttemptValue.
private long storedPerAttemptValue(Map<TaskAttempt, AtomicLong> data, TezTaskAttemptID attemptID) {
Task task = vertex.getTask(attemptID.getTaskID());
if (task == null) {
return -1L;
}
TaskAttempt taskAttempt = task.getAttempt(attemptID);
if (taskAttempt == null) {
return -1L;
}
AtomicLong estimate = data.get(taskAttempt);
return estimate == null ? -1L : estimate.get();
}
use of org.apache.tez.dag.app.dag.TaskAttempt in project tez by apache.
the class StartEndTimesBase method updateAttempt.
@Override
public void updateAttempt(TezTaskAttemptID attemptID, TaskAttemptState state, long timestamp) {
Task task = vertex.getTask(attemptID.getTaskID());
if (task == null) {
return;
}
Long boxedStart = startTimes.get(attemptID);
long start = boxedStart == null ? Long.MIN_VALUE : boxedStart;
TaskAttempt taskAttempt = task.getAttempt(attemptID);
if (taskAttempt.getState() == TaskAttemptState.SUCCEEDED) {
boolean isNew = false;
// is this a new success?
synchronized (doneTasks) {
if (!doneTasks.contains(task)) {
doneTasks.add(task);
isNew = true;
}
}
// local data] we only count the first one.
if (isNew) {
long finish = timestamp;
if (start > 1L && finish > 1L && start <= finish) {
long duration = finish - start;
taskStatistics.add(duration);
}
}
}
}
Aggregations