Search in sources :

Example 6 with TaskAttempt

use of org.apache.hyracks.control.cc.job.TaskAttempt in project asterixdb by apache.

the class JobExecutor method notifyTaskComplete.

public void notifyTaskComplete(TaskAttempt ta) throws HyracksException {
    TaskAttemptId taId = ta.getTaskAttemptId();
    TaskCluster tc = ta.getTask().getTaskCluster();
    TaskClusterAttempt lastAttempt = findLastTaskClusterAttempt(tc);
    if (lastAttempt == null || taId.getAttempt() != lastAttempt.getAttempt()) {
        LOGGER.warning("Ignoring task complete notification: " + taId + " -- Current last attempt = " + lastAttempt);
        return;
    }
    TaskAttempt.TaskStatus taStatus = ta.getStatus();
    if (taStatus != TaskAttempt.TaskStatus.RUNNING) {
        LOGGER.warning("Spurious task complete notification: " + taId + " Current state = " + taStatus);
        return;
    }
    ta.setStatus(TaskAttempt.TaskStatus.COMPLETED, null);
    ta.setEndTime(System.currentTimeMillis());
    if (lastAttempt.decrementPendingTasksCounter() == 0) {
        lastAttempt.setStatus(TaskClusterAttempt.TaskClusterStatus.COMPLETED);
        lastAttempt.setEndTime(System.currentTimeMillis());
        inProgressTaskClusters.remove(tc);
        startRunnableActivityClusters();
    }
}
Also used : TaskClusterAttempt(org.apache.hyracks.control.cc.job.TaskClusterAttempt) TaskAttemptId(org.apache.hyracks.api.dataflow.TaskAttemptId) TaskCluster(org.apache.hyracks.control.cc.job.TaskCluster) TaskAttempt(org.apache.hyracks.control.cc.job.TaskAttempt)

Aggregations

TaskAttempt (org.apache.hyracks.control.cc.job.TaskAttempt)6 TaskClusterAttempt (org.apache.hyracks.control.cc.job.TaskClusterAttempt)5 TaskCluster (org.apache.hyracks.control.cc.job.TaskCluster)4 ActivityId (org.apache.hyracks.api.dataflow.ActivityId)3 TaskAttemptId (org.apache.hyracks.api.dataflow.TaskAttemptId)3 ActivityCluster (org.apache.hyracks.api.job.ActivityCluster)3 Task (org.apache.hyracks.control.cc.job.Task)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Map (java.util.Map)2 TaskId (org.apache.hyracks.api.dataflow.TaskId)2 INodeManager (org.apache.hyracks.control.cc.cluster.INodeManager)2 HashSet (java.util.HashSet)1 NetworkAddress (org.apache.hyracks.api.comm.NetworkAddress)1 Constraint (org.apache.hyracks.api.constraints.Constraint)1 LValueConstraintExpression (org.apache.hyracks.api.constraints.expressions.LValueConstraintExpression)1 PartitionLocationExpression (org.apache.hyracks.api.constraints.expressions.PartitionLocationExpression)1 ConnectorDescriptorId (org.apache.hyracks.api.dataflow.ConnectorDescriptorId)1 IConnectorDescriptor (org.apache.hyracks.api.dataflow.IConnectorDescriptor)1