@Override protected TaskStatusState fromTask(TaskServiceDocument<DefaultSubStage> state) { TaskStatusState statusTask = super.fromTask(state); statusTask.name = state.getCustomProperty(PKS_CLUSTER_NAME_PROP_NAME); return statusTask; }
public RequestBrokerFactoryService() { super(RequestBrokerState.class); super.toggleOption(ServiceOption.PERSISTENCE, true); super.toggleOption(ServiceOption.REPLICATION, true); }
public PKSClusterProvisioningTaskService() { super(PKSProvisioningTaskState.class, DefaultSubStage.class, DISPLAY_NAME); super.toggleOption(ServiceOption.PERSISTENCE, true); super.toggleOption(ServiceOption.REPLICATION, true); super.toggleOption(ServiceOption.OWNER_SELECTION, true); super.toggleOption(ServiceOption.PERIODIC_MAINTENANCE, true); super.setMaintenanceIntervalMicros(POLL_PKS_ENDPOINT_INTERVAL_MICROS); super.transientSubStages = DefaultSubStage.TRANSIENT_SUB_STAGES; }
protected void createCounterSubTask(T state, long count, Enum<?> substageComplete, Consumer<String> callbackFunction) { CounterSubTaskState subTaskInitState = new CounterSubTaskState(); subTaskInitState.completionsRemaining = count; subTaskInitState.documentExpirationTimeMicros = ServiceUtils .getDefaultTaskExpirationTimeInMicros(); subTaskInitState.serviceTaskCallback = ServiceTaskCallback.create( getSelfLink(), TaskStage.STARTED, substageComplete, TaskStage.STARTED, DefaultSubStage.ERROR); CounterSubTaskService.createSubTask(this, subTaskInitState, callbackFunction); }
public ClosureProvisionTaskService() { super(ClosureProvisionTaskState.class, SubStage.class, DISPLAY_NAME); super.toggleOption(Service.ServiceOption.PERSISTENCE, true); super.toggleOption(Service.ServiceOption.REPLICATION, true); super.toggleOption(Service.ServiceOption.OWNER_SELECTION, true); super.toggleOption(Service.ServiceOption.IDEMPOTENT_POST, true); }
private EventTopicState createTopicState(String substage, String topicId) { EventTopicState state = new EventTopicState(); state.topicTaskInfo = new TopicTaskInfo(); state.topicTaskInfo.task = "task"; state.topicTaskInfo.stage = "stage"; state.topicTaskInfo.substage = substage; state.id = topicId; state.name = topicId; state.blockable = false; state.schema = ""; return state; }
protected void handleFailedStagePatch(T state) { ServiceErrorResponse err = state.taskInfo.failure; logWarning("Task failed with: %s", err == null ? "n.a." : err.message); if (err != null && err.stackTrace != null) { logFine("Task failure stack trace: %s", err.stackTrace); } notifyCallerService(state); }
protected TaskStatusState fromTask(TaskServiceDocument<E> state) { return fromTask(new TaskStatusState(), state); }
@Override public void handleStart(Operation startPost) { // invoke handleCreate() from handleStart() since services inheriting // AbstractCallbackServiceHandler are started getHost().startService(...) // in which case handleCreate() is not being called. super.handleCreate(startPost); // startPost.complete() will not be called above since // validateStateOnStart() method bellow returns true, // which will prevent startPost operation to be completed in handleCreate() super.handleStart(startPost); }
@Override protected TaskStatusState fromTask(TaskServiceDocument<SubStage> state) { final TaskStatusState statusTask = super.fromTask(state); statusTask.name = ((KubernetesProvisioningTaskState) state).descName; return statusTask; }
/** * Moves the task to the given subStage. The method assumes the task stage is STARTED as this is * the stage where most sub-stage transition happen. */ protected void proceedTo(E subStage, Consumer<T> patchBodyConfigurator) { proceedTo(TaskStage.STARTED, subStage, patchBodyConfigurator); }
public AuthBootstrapService() { super(ServiceDocument.class); toggleOption(ServiceOption.IDEMPOTENT_POST, true); toggleOption(ServiceOption.PERSISTENCE, true); toggleOption(ServiceOption.REPLICATION, true); toggleOption(ServiceOption.OWNER_SELECTION, true); }
@Override public Service createServiceInstance() { return new ConfigurationService(); } }
public CompositeDescriptionFactoryService() { super(CompositeDescription.class); super.toggleOption(ServiceOption.PERSISTENCE, true); super.toggleOption(ServiceOption.REPLICATION, true); super.toggleOption(ServiceOption.IDEMPOTENT_POST, true); }
public PKSClusterRemovalTaskService() { super(PKSClusterRemovalTaskState.class, SubStage.class, DISPLAY_NAME); super.toggleOption(ServiceOption.PERSISTENCE, true); super.toggleOption(ServiceOption.REPLICATION, true); super.toggleOption(ServiceOption.OWNER_SELECTION, true); super.toggleOption(ServiceOption.PERIODIC_MAINTENANCE, true); super.setMaintenanceIntervalMicros(POLL_PKS_ENDPOINT_INTERVAL_MICROS); super.transientSubStages = SubStage.TRANSIENT_SUB_STAGES; }
public ContainerOperationTaskService() { super(ContainerOperationTaskState.class, SubStage.class, DISPLAY_NAME); super.toggleOption(ServiceOption.PERSISTENCE, true); super.toggleOption(ServiceOption.REPLICATION, true); super.toggleOption(ServiceOption.OWNER_SELECTION, true); }
/** * Completes the task by setting its stage to FINISHED. The subStage can be specified, and if * not, the one named COMPLETED will be used, if any. */ protected void complete(E subStage, Consumer<T> patchBodyConfigurator) { proceedTo(TaskStage.FINISHED, subStage, patchBodyConfigurator); }
public CompositionTaskFactoryService() { super(CompositionTaskState.class); super.toggleOption(ServiceOption.PERSISTENCE, true); super.toggleOption(ServiceOption.REPLICATION, true); }
public PKSClusterResizeTaskService() { super(PKSClusterResizeTaskState.class, DefaultSubStage.class, DISPLAY_NAME); super.toggleOption(ServiceOption.PERSISTENCE, true); super.toggleOption(ServiceOption.REPLICATION, true); super.toggleOption(ServiceOption.OWNER_SELECTION, true); super.toggleOption(ServiceOption.INSTRUMENTATION, true); super.toggleOption(ServiceOption.PERIODIC_MAINTENANCE, true); super.setMaintenanceIntervalMicros(POLL_PKS_ENDPOINT_INTERVAL_MICROS); super.transientSubStages = DefaultSubStage.TRANSIENT_SUB_STAGES; }
public CompositionSubTaskService() { super(CompositionSubTaskState.class, SubStage.class, DISPLAY_NAME); super.toggleOption(ServiceOption.PERSISTENCE, true); super.toggleOption(ServiceOption.REPLICATION, true); super.toggleOption(ServiceOption.OWNER_SELECTION, true); super.transientSubStages = SubStage.TRANSIENT_SUB_STAGES; }