/** * Schedule a {@link TaskMetricsUpdater}. * * @param taskMetricsUpdater the {@link TaskMetricsUpdater} to schedule * @param task the {@link Task} that the {@link TaskMetricsUpdater} is associated to * @return a {@link java.util.concurrent.ScheduledFuture} corresponding to the scheduled {@link TaskMetricsUpdater} */ protected ScheduledFuture<?> scheduleTaskMetricsUpdater(Runnable taskMetricsUpdater, Task task) { return this.taskMetricsUpdaterExecutor.scheduleAtFixedRate(taskMetricsUpdater, task.getTaskContext().getStatusReportingInterval(), task.getTaskContext().getStatusReportingInterval(), TimeUnit.MILLISECONDS); }
private void onStart(long startTime) { Long queueTime = queuedTasks.remove(this.underlyingTask.getTaskId()); long workUnitCreationTime = this.underlyingTask.getTaskContext().getTaskState().getPropAsLong(ConfigurationKeys.WORK_UNIT_CREATION_TIME_IN_MILLIS, 0); long timeInQueue = startTime - queueTime; long timeSinceWorkUnitCreation = startTime - workUnitCreationTime; taskCreateAndRunTimer.update(timeSinceWorkUnitCreation, TimeUnit.MILLISECONDS); LOG.debug(String.format("Task %s started. Saving queued time of %d ms to history.", underlyingTask.getTaskId(), timeInQueue)); queuedTaskTimeHistorical.putIfAbsent(System.currentTimeMillis(), timeInQueue); runningTaskCount.inc(); } }
/** * Schedule a {@link TaskMetricsUpdater}. * * @param taskMetricsUpdater the {@link TaskMetricsUpdater} to schedule * @param task the {@link Task} that the {@link TaskMetricsUpdater} is associated to * @return a {@link java.util.concurrent.ScheduledFuture} corresponding to the scheduled {@link TaskMetricsUpdater} */ protected ScheduledFuture<?> scheduleTaskMetricsUpdater(Runnable taskMetricsUpdater, Task task) { return this.taskMetricsUpdaterExecutor.scheduleAtFixedRate(taskMetricsUpdater, task.getTaskContext().getStatusReportingInterval(), task.getTaskContext().getStatusReportingInterval(), TimeUnit.MILLISECONDS); }
private void onStart(long startTime) { Long queueTime = queuedTasks.remove(this.underlyingTask.getTaskId()); long workUnitCreationTime = this.underlyingTask.getTaskContext().getTaskState().getPropAsLong(ConfigurationKeys.WORK_UNIT_CREATION_TIME_IN_MILLIS, 0); long timeInQueue = startTime - queueTime; long timeSinceWorkUnitCreation = startTime - workUnitCreationTime; taskCreateAndRunTimer.update(timeSinceWorkUnitCreation, TimeUnit.MILLISECONDS); LOG.debug(String.format("Task %s started. Saving queued time of %d ms to history.", underlyingTask.getTaskId(), timeInQueue)); queuedTaskTimeHistorical.putIfAbsent(System.currentTimeMillis(), timeInQueue); runningTaskCount.inc(); } }