use of com.netflix.titus.common.framework.scheduler.model.SchedulingStatus.SchedulingState in project titus-control-plane by Netflix.
the class LocalSchedulerTransactionLogger method logScheduleUpdateEvent.
private static String logScheduleUpdateEvent(ScheduleUpdateEvent event) {
SchedulingStatus status = event.getSchedule().getCurrentAction().getStatus();
SchedulingState schedulingState = status.getState();
String summary;
switch(schedulingState) {
case Waiting:
summary = "Waiting...";
break;
case Running:
summary = "Running...";
break;
case Cancelling:
summary = "Schedule cancelled by a user";
break;
case Succeeded:
summary = "Scheduled action completed";
break;
case Failed:
summary = "Scheduled action failed: error=" + status.getError().map(Throwable::getMessage).orElse("<error_not_available>");
break;
default:
summary = "Unknown scheduling state: schedulingState=" + schedulingState;
}
return doFormat(event.getSchedule(), "ExecutionUpdate", summary);
}
use of com.netflix.titus.common.framework.scheduler.model.SchedulingStatus.SchedulingState in project titus-control-plane by Netflix.
the class ScheduleMetrics method onSchedulingStateUpdate.
void onSchedulingStateUpdate(Schedule schedule) {
this.lastSchedule = schedule;
SchedulingState state = schedule.getCurrentAction().getStatus().getState();
if (state.isFinal()) {
if (state == SchedulingState.Succeeded) {
successes.increment();
} else {
failures.increment();
}
} else {
currentState.transition(state);
}
}
use of com.netflix.titus.common.framework.scheduler.model.SchedulingStatus.SchedulingState in project titus-control-plane by Netflix.
the class ScheduledActionExecutor method handleExecution.
/**
* Invocations serialized with cancel.
*/
boolean handleExecution() {
SchedulingState state = action.getStatus().getState();
switch(state) {
case Waiting:
boolean changed = handleWaitingState();
if (changed) {
scheduleMetrics.onSchedulingStateUpdate(this.getSchedule());
}
return changed;
case Running:
boolean runningChanged = handleRunningState();
if (runningChanged) {
scheduleMetrics.onSchedulingStateUpdate(this.getSchedule());
}
return runningChanged;
case Cancelling:
boolean cancellingChanged = handleCancellingState();
if (cancellingChanged) {
scheduleMetrics.onScheduleRemoved(this.getSchedule());
}
return cancellingChanged;
case Succeeded:
case Failed:
Preconditions.checkState(false, "Invocation of the terminated action executor: state={}", state);
}
Preconditions.checkState(false, "Unrecognized state: {}", state);
return false;
}
Aggregations