Search in sources :

Example 1 with LongRunningTaskTrackerFactory

use of io.datarouter.tasktracker.service.LongRunningTaskTrackerFactory in project datarouter by hotpads.

the class JobWrapper method initTracker.

private static LongRunningTaskTracker initTracker(JobPackage jobPackage, String trackerName, Instant triggerTime, Instant scheduledTime, LongRunningTaskTrackerFactory longRunningTaskTrackerFactory, String triggeredBy) {
    Instant deadline = Optional.ofNullable(jobPackage).flatMap(jp -> jp.getSoftDeadline(triggerTime)).orElse(null);
    boolean warnOnReachingDeadline = Optional.ofNullable(jobPackage).flatMap(JobPackage::getWarnOnReachingDuration).orElse(false);
    return longRunningTaskTrackerFactory.create(trackerName, LongRunningTaskType.JOB, deadline, warnOnReachingDeadline, triggeredBy).setTriggerTime(triggerTime).setScheduledTime(scheduledTime);
}
Also used : LongRunningTaskType(io.datarouter.tasktracker.scheduler.LongRunningTaskType) LongRunningTaskStatus(io.datarouter.tasktracker.scheduler.LongRunningTaskStatus) LongRunningTaskTrackerFactory(io.datarouter.tasktracker.service.LongRunningTaskTrackerFactory) Logger(org.slf4j.Logger) BaseJob(io.datarouter.job.BaseJob) Date(java.util.Date) ComparableTool(io.datarouter.util.ComparableTool) LoggerFactory(org.slf4j.LoggerFactory) Callable(java.util.concurrent.Callable) Instant(java.time.Instant) Singleton(javax.inject.Singleton) Tracer(io.datarouter.instrumentation.trace.Tracer) DatarouterDuration(io.datarouter.util.duration.DatarouterDuration) Inject(javax.inject.Inject) Future(java.util.concurrent.Future) LongRunningTaskTracker(io.datarouter.tasktracker.service.LongRunningTaskTracker) Duration(java.time.Duration) Optional(java.util.Optional) JobCounters(io.datarouter.job.JobCounters) TracerThreadLocal(io.datarouter.instrumentation.trace.TracerThreadLocal) Instant(java.time.Instant)

Aggregations

Tracer (io.datarouter.instrumentation.trace.Tracer)1 TracerThreadLocal (io.datarouter.instrumentation.trace.TracerThreadLocal)1 BaseJob (io.datarouter.job.BaseJob)1 JobCounters (io.datarouter.job.JobCounters)1 LongRunningTaskStatus (io.datarouter.tasktracker.scheduler.LongRunningTaskStatus)1 LongRunningTaskType (io.datarouter.tasktracker.scheduler.LongRunningTaskType)1 LongRunningTaskTracker (io.datarouter.tasktracker.service.LongRunningTaskTracker)1 LongRunningTaskTrackerFactory (io.datarouter.tasktracker.service.LongRunningTaskTrackerFactory)1 ComparableTool (io.datarouter.util.ComparableTool)1 DatarouterDuration (io.datarouter.util.duration.DatarouterDuration)1 Duration (java.time.Duration)1 Instant (java.time.Instant)1 Date (java.util.Date)1 Optional (java.util.Optional)1 Callable (java.util.concurrent.Callable)1 Future (java.util.concurrent.Future)1 Inject (javax.inject.Inject)1 Singleton (javax.inject.Singleton)1 Logger (org.slf4j.Logger)1 LoggerFactory (org.slf4j.LoggerFactory)1