public void addTask(Task task) { taskMap.put(task.getTaskAttemptId(), task); }
public void removeTask(Task task) { taskMap.remove(task.getTaskAttemptId()); if (cleanupPending && taskMap.isEmpty()) { performCleanup(); } }
private void logPendingTasks() { for (Task task : runningTasks) { final List<Thread> pendingThreads = task.getPendingThreads(); LOGGER.error("task {} was stuck. Stuck thread count = {}", task.getTaskAttemptId(), pendingThreads.size()); for (Thread thread : pendingThreads) { LOGGER.error("Stuck thread trace", ExceptionUtils.fromThreadStack(thread)); } } } }
public void dumpProfile(JobletProfile jProfile) { Map<String, Long> counters = jProfile.getCounters(); counterMap.forEach((key, value) -> counters.put(key, value.get())); for (Task task : taskMap.values()) { TaskProfile taskProfile = new TaskProfile(task.getTaskAttemptId(), new Hashtable<>(task.getPartitionSendProfile()), new StatsCollector()); task.dumpProfile(taskProfile); jProfile.getTaskProfiles().put(task.getTaskAttemptId(), taskProfile); } }
@Override public String toString() { return getName() + ": [" + ncs.getId() + "[" + task.getJoblet().getJobId() + ":" + task.getTaskAttemptId() + "]"; } }
@Override public void run() { TaskProfile taskProfile = new TaskProfile(task.getTaskAttemptId(), task.getPartitionSendProfile(), task.getStatsCollector()); try { ncs.getClusterController(task.getJobletContext().getJobId().getCcId()).notifyTaskComplete( task.getJobletContext().getJobId(), task.getTaskAttemptId(), ncs.getId(), taskProfile); } catch (Exception e) { LOGGER.log(Level.ERROR, "Failed notifying task complete for " + task.getTaskAttemptId(), e); } task.getJoblet().removeTask(task); }
private IPartitionCollector createPartitionCollector(TaskAttemptDescriptor td, final int partition, Task task, int i, IConnectorDescriptor conn, RecordDescriptor recordDesc, IConnectorPolicy cPolicy) throws HyracksDataException { IPartitionCollector collector = conn.createPartitionCollector(task, recordDesc, partition, td.getInputPartitionCounts()[i], td.getPartitionCount()); if (cPolicy.materializeOnReceiveSide()) { return new ReceiveSideMaterializingCollector(task, ncs.getPartitionManager(), collector, task.getTaskAttemptId(), ncs.getExecutor()); } else { return collector; } }
exceptions.add(HyracksDataException.create(TASK_ABORTED, getTaskAttemptId())); ExceptionUtils.setNodeIds(exceptions, ncs.getId()); ncs.getWorkQueue()