@Override public void inc(long n) { super.inc(n); if (this.parentCounter.isPresent()) { this.parentCounter.get().inc(n); } }
@Override public void onDeleteSpec(URI deletedSpecURI, String deletedSpecVersion) { this.numDeletedSpecs.inc(); submitTrackingEvent(deletedSpecURI, deletedSpecVersion, SPEC_DELETED_OPERATION_TYPE); }
@Override public void onDeleteJob(URI deletedJobURI, String deletedJobVersion) { this.numDeletedJobs.inc(); submitTrackingEvent(deletedJobURI, deletedJobVersion, JOB_DELETED_OPERATION_TYPE); }
@Override public void onUpdateJob(JobSpec updatedJob) { this.numUpdatedJobs.inc(); submitTrackingEvent(updatedJob, JOB_UPDATED_OPERATION_TYPE); } }
@Override public void onUpdateSpec(Spec updatedSpec) { this.numUpdatedSpecs.inc(); submitTrackingEvent(updatedSpec, SPEC_UPDATED_OPERATION_TYPE); } }
@Override public void onAddJob(JobSpec addedJob) { this.numAddedJobs.inc(); submitTrackingEvent(addedJob, JOB_ADDED_OPERATION_TYPE); }
@Override public void onAddSpec(Spec addedSpec) { this.numAddedSpecs.inc(); submitTrackingEvent(addedSpec, SPEC_ADDED_OPERATION_TYPE); }
@Override public void onJobCancellation(JobContext jobContext) throws Exception { super.onJobCancellation(jobContext); _jobState.switchToCancelled(); if (_instrumentationEnabled && null != _launcherMetrics) { _launcherMetrics.getNumJobsCancelled().inc(); } } }
@Override public void onJobPrepare(JobContext jobContext) throws Exception { super.onJobPrepare(jobContext); _jobContext = jobContext; if (_jobState.getRunningState() == null) { _jobState.switchToPending(); } _jobState.switchToRunning(); if (_instrumentationEnabled && null != _launcherMetrics) { _launcherMetrics.getNumJobsLaunched().inc(); } }
@Override public void onJobCompletion(JobContext jobContext) throws Exception { Preconditions.checkArgument(jobContext.getJobState().getState() == RunningState.SUCCESSFUL || jobContext.getJobState().getState() == RunningState.COMMITTED || jobContext.getJobState().getState() == RunningState.FAILED, "Unexpected state: " + jobContext.getJobState().getState() + " in " + jobContext); super.onJobCompletion(jobContext); if (_instrumentationEnabled && null != _launcherMetrics) { _launcherMetrics.getNumJobsCompleted().inc(); } if (jobContext.getJobState().getState() == RunningState.FAILED) { if (_instrumentationEnabled && null != _launcherMetrics) { _launcherMetrics.getNumJobsFailed().inc(); } _jobState.switchToFailed(); } else { // TODO Remove next line once the JobLauncher starts sending notifications for success _jobState.switchToSuccessful(); _jobState.switchToCommitted(); if (_instrumentationEnabled && null != _launcherMetrics) { _launcherMetrics.getNumJobsCommitted().inc(); } } }