@Override protected boolean skipExtensibility(ContainerAllocationTaskState state) { return isAllocationRequest(state) && state.taskSubStage != SubStage.BUILD_RESOURCES_LINKS; }
private void provisionAllocatedContainers(ContainerAllocationTaskState state, ServiceTaskCallback taskCallback) { final boolean allocationRequest = isAllocationRequest(state); if (taskCallback == null) { // create a counter subtask link first createCounterSubTaskCallback(state, state.resourceCount, !allocationRequest, !allocationRequest || state.postAllocation ? SubStage.WAITING_FOR_HEALTH_CHECK : SubStage.COMPLETED, (serviceTask) -> provisionAllocatedContainers(state, serviceTask)); return; } logInfo("Provision request for %s containers", state.resourceCount); for (String resourceLink : state.resourceLinks) { createContainerInstanceRequests(state, taskCallback, resourceLink); } proceedTo(SubStage.PROVISIONING); }
private void createContainerStates(ContainerAllocationTaskState state, ContainerDescription containerDesc, ServiceTaskCallback taskCallback) { final boolean allocationRequest = isAllocationRequest(state); if (taskCallback == null) {
private void allocatePorts(ContainerAllocationTaskState state) { final boolean allocationRequest = isAllocationRequest(state); // if it is composition allocation request, move to COMPLETED SubStage when complete // if it is Admiral provisioning request, move to START_PROVISIONING SubStage when complete SubStage completionStage = allocationRequest ? SubStage.COMPLETED : SubStage.START_PROVISIONING; ContainerPortsAllocationTaskService.ContainerPortsAllocationTaskState portsAllocationTask = new ContainerPortsAllocationTaskService.ContainerPortsAllocationTaskState(); portsAllocationTask.containerStateLinks = state.resourceLinks; portsAllocationTask.serviceTaskCallback = ServiceTaskCallback.create(getSelfLink(), TaskStage.STARTED, completionStage, TaskStage.STARTED, SubStage.ERROR); portsAllocationTask.documentSelfLink = getSelfId(); portsAllocationTask.requestTrackerLink = state.requestTrackerLink; sendRequest(Operation.createPost(this, ContainerPortsAllocationTaskService.FACTORY_LINK) .setBody(portsAllocationTask) .setCompletion((o, e) -> { if (e != null) { failTask("Failure creating port allocation task", e); return; } })); }