Search in sources :

Example 6 with Retryer

use of com.netflix.titus.common.util.retry.Retryer in project titus-control-plane by Netflix.

the class CreateOrReplaceServiceTaskActions method createOriginalTaskChangeAction.

private static TitusChangeAction createOriginalTaskChangeAction(Job<ServiceJobExt> job, JobStore jobStore, VersionSupplier versionSupplier, Clock clock, Map<String, String> taskContext) {
    Retryer newRetryer = JobFunctions.retryer(job);
    ServiceJobTask newTask = createNewServiceTask(job, clock.wallTime(), taskContext, versionSupplier);
    String summary = String.format("Creating new service task in DB store: %s", newTask.getId());
    return TitusChangeAction.newAction("createOrReplaceTask").id(newTask.getId()).trigger(V3JobOperations.Trigger.Reconciler).summary(summary).changeWithModelUpdates(self -> jobStore.storeTask(newTask).andThen(Observable.just(createNewTaskModelAction(self, newTask, Optional.empty(), newRetryer))));
}
Also used : Retryer(com.netflix.titus.common.util.retry.Retryer) ServiceJobTask(com.netflix.titus.api.jobmanager.model.job.ServiceJobTask)

Example 7 with Retryer

use of com.netflix.titus.common.util.retry.Retryer in project titus-control-plane by Netflix.

the class CreateOrReplaceServiceTaskActions method createResubmittedTaskChangeAction.

private static TitusChangeAction createResubmittedTaskChangeAction(EntityHolder jobHolder, EntityHolder taskHolder, JobServiceRuntime context, JobStore jobStore, VersionSupplier versionSupplier, Clock clock, Map<String, String> taskContext) {
    ServiceJobTask oldTask = taskHolder.getEntity();
    long timeInStartedState = JobFunctions.getTimeInState(oldTask, TaskState.Started, clock).orElse(0L);
    Retryer nextTaskRetryer = timeInStartedState >= context.getConfiguration().getTaskRetryerResetTimeMs() ? JobFunctions.retryer(jobHolder.getEntity()) : TaskRetryers.getNextTaskRetryer(context::getSystemRetryer, jobHolder.getEntity(), taskHolder);
    ServiceJobTask newTask = createServiceTaskReplacement(jobHolder.getEntity(), oldTask, clock.wallTime(), taskContext, versionSupplier);
    String summary = String.format("Replacing service task in DB store: resubmit=%d, originalId=%s, previousId=%s, newId=%s", newTask.getResubmitNumber(), oldTask.getOriginalId(), oldTask.getId(), newTask.getId());
    return TitusChangeAction.newAction("createOrReplaceTask").id(newTask.getId()).trigger(V3JobOperations.Trigger.Reconciler).summary(summary).changeWithModelUpdates(self -> jobStore.replaceTask(oldTask, newTask).andThen(Observable.just(createTaskResubmitModelActions(self, oldTask, newTask, nextTaskRetryer))));
}
Also used : Retryer(com.netflix.titus.common.util.retry.Retryer) ServiceJobTask(com.netflix.titus.api.jobmanager.model.job.ServiceJobTask)

Aggregations

Retryer (com.netflix.titus.common.util.retry.Retryer)7 BatchJobTask (com.netflix.titus.api.jobmanager.model.job.BatchJobTask)2 ServiceJobTask (com.netflix.titus.api.jobmanager.model.job.ServiceJobTask)2 Test (org.junit.Test)2