@Test public void testTaskProgress() { LOG.info("--- START: testTaskProgress ---"); TezTaskID taskId = getNewTaskID(); scheduleTaskAttempt(taskId); float progress = 0f; assert (mockTask.getProgress() == progress); launchTaskAttempt(mockTask.getLastAttempt().getID()); progress = 50f; updateAttemptProgress(mockTask.getLastAttempt(), progress); assert (mockTask.getProgress() == progress); progress = 100f; updateAttemptProgress(mockTask.getLastAttempt(), progress); assert (mockTask.getProgress() == progress); progress = 0f; updateAttemptState(mockTask.getLastAttempt(), TaskAttemptState.KILLED); assert (mockTask.getProgress() == progress); killRunningTaskAttempt(mockTask.getLastAttempt().getID()); assert (mockTask.getAttemptList().size() == 2); assert (mockTask.getProgress() == 0f); launchTaskAttempt(mockTask.getLastAttempt().getID()); progress = 50f; updateAttemptProgress(mockTask.getLastAttempt(), progress); assert (mockTask.getProgress() == progress); }
@Override public float getProgress() { readLock.lock(); try { TaskAttempt bestAttempt = selectBestAttempt(); if (bestAttempt == null) { return 0f; } return bestAttempt.getProgress(); } finally { readLock.unlock(); } }
TaskImpl implements Task, EventHandler<TaskEvent> { @Override public float getProgress() { readLock.lock(); try { TaskAttempt bestAttempt = selectBestAttempt(); if (bestAttempt == null) { return 0f; } return bestAttempt.getProgress(); } finally { readLock.unlock(); } } }
TaskImpl implements Task, EventHandler<TaskEvent> { @Override public float getProgress() { readLock.lock(); try { TaskAttempt bestAttempt = selectBestAttempt(); if (bestAttempt == null) { return 0f; } return bestAttempt.getProgress(); } finally { readLock.unlock(); } } TaskImpl(TezVertexID vertexId, int taskIndex,
      EventHandler eventHandler, Configuration conf,
      TaskAttemptListener taskAttemptListener,
      Clock clock, TaskHeartbeatHandler thh, AppContext appContext,
      boolean leafVertex, Resource resource,
      ContainerContext containerContext); }
TaskImpl implements Task, EventHandler<TaskEvent> { @Override public float getProgress() { readLock.lock(); try { TaskAttempt bestAttempt = selectBestAttempt(); if (bestAttempt == null) { return 0f; } return bestAttempt.getProgress(); } finally { readLock.unlock(); } } TaskImpl(TezVertexID vertexId, int taskIndex,
      EventHandler eventHandler, Configuration conf,
      TaskAttemptListener taskAttemptListener,
      Clock clock, TaskHeartbeatHandler thh, AppContext appContext,
      boolean leafVertex, Resource resource,
      ContainerContext containerContext); @Override TaskState getState(); @Override Map<TezTaskAttemptID, TaskAttempt> getAttempts(); @Override TaskAttempt getAttempt(TezTaskAttemptID attemptID); @Override Vertex getVertex(); @Override TezTaskID getTaskId(); @Override boolean isFinished(); @Override TaskReport getReport(); @Override TezCounters getCounters(); @Override float getProgress(); @Override List<TezEvent> getTaskAttemptTezEvents(TezTaskAttemptID attemptID,
      int fromEventId, int maxEvents); @Override List<String> getDiagnostics(); @Override TaskState restoreFromEvent(HistoryEvent historyEvent); @VisibleForTesting TaskStateInternal getInternalState(); @Override boolean canCommit(TezTaskAttemptID taskAttemptID); @Override boolean needsWaitAfterOutputConsumable(); @Override TezTaskAttemptID getOutputConsumableAttempt(); @Override TaskAttempt getSuccessfulAttempt(); @Override void handle(TaskEvent event); }
TaskImpl implements Task, EventHandler<TaskEvent> { @Override public float getProgress() { readLock.lock(); try { TaskAttempt bestAttempt = selectBestAttempt(); if (bestAttempt == null) { return 0f; } return bestAttempt.getProgress(); } finally { readLock.unlock(); } } TaskImpl(TezVertexID vertexId, int taskIndex,
      EventHandler eventHandler, Configuration conf,
      TaskAttemptListener taskAttemptListener,
      Clock clock, TaskHeartbeatHandler thh, AppContext appContext,
      boolean leafVertex, Resource resource,
      ContainerContext containerContext); @Override TaskState getState(); @Override Map<TezTaskAttemptID, TaskAttempt> getAttempts(); @Override TaskAttempt getAttempt(TezTaskAttemptID attemptID); @Override Vertex getVertex(); @Override TezTaskID getTaskId(); @Override boolean isFinished(); @Override TaskReport getReport(); @Override TezCounters getCounters(); @Override float getProgress(); @Override List<TezEvent> getTaskAttemptTezEvents(TezTaskAttemptID attemptID,
      int fromEventId, int maxEvents); @Override List<String> getDiagnostics(); @Override TaskState restoreFromEvent(HistoryEvent historyEvent); @VisibleForTesting TaskStateInternal getInternalState(); @Override boolean canCommit(TezTaskAttemptID taskAttemptID); @Override boolean needsWaitAfterOutputConsumable(); @Override TezTaskAttemptID getOutputConsumableAttempt(); @Override TaskAttempt getSuccessfulAttempt(); @Override void handle(TaskEvent event);  }