}); ContainerAllocationTaskState patch = new ContainerAllocationTaskState(); patch.hostSelections = copySelections; patch.taskInfo = state.taskInfo;
String contextId = state.getCustomProperty(FIELD_NAME_CONTEXT_ID_KEY); if ((contextId != null && !isClusteringOperation(state) && !contextId.equals(getSelfId()))
createResourcePool(), true); ContainerAllocationTaskState allocationTask = new ContainerAllocationTaskState(); allocationTask.resourceDescriptionLink = agentContainerDesc.documentSelfLink; allocationTask.groupResourcePlacementLink = groupPlacementState.documentSelfLink;
private void createContainerAllocationTask(RequestBrokerState state) { getContainerDescription(state, (containerDesc) -> { ContainerAllocationTaskState allocationTask = new ContainerAllocationTaskState(); allocationTask.documentSelfLink = getSelfId(); allocationTask.serviceTaskCallback = ServiceTaskCallback.create(
private void createContainerAllocationTaskState(CompositionSubTaskState state) { ContainerAllocationTaskState allocationTask = new ContainerAllocationTaskState(); allocationTask.documentSelfLink = getSelfId(); allocationTask.serviceTaskCallback = ServiceTaskCallback.create(getSelfLink(), TaskStage.STARTED, SubStage.COMPLETED, TaskStage.STARTED, SubStage.ERROR); allocationTask.customProperties = state.customProperties; allocationTask.resourceDescriptionLink = state.resourceDescriptionLink; allocationTask.resourceCount = Long.valueOf(state.resourceLinks.size()); allocationTask.resourceType = state.resourceType; allocationTask.tenantLinks = state.tenantLinks; allocationTask.requestTrackerLink = state.requestTrackerLink; allocationTask.resourceLinks = state.resourceLinks; allocationTask.postAllocation = state.postAllocation; sendRequest(Operation.createPost(this, ContainerAllocationTaskFactoryService.SELF_LINK) .setBody(allocationTask) .setContextId(state.requestId) .setCompletion((o, e) -> { if (e != null) { failTask("Failure creating container allocation task", e); return; } })); proceedTo(SubStage.EXECUTING); }
private void prepareContext(ContainerAllocationTaskState state, ContainerDescription containerDesc) { if (state.postAllocation) { proceedTo(SubStage.PLACEMENT_HOST_SELECTED); return; } if (containerDesc == null) { getContainerDescription(state, (contDesc) -> this.prepareContext(state, contDesc)); return; } proceedTo(SubStage.CONTEXT_PREPARED, s -> { // merge request/allocation properties over the container description properties s.customProperties = mergeCustomProperties(containerDesc.customProperties, state.customProperties); if (s.getCustomProperty(FIELD_NAME_CONTEXT_ID_KEY) == null) { s.addCustomProperty(FIELD_NAME_CONTEXT_ID_KEY, getSelfId()); } s.descName = containerDesc.name; }); }
private boolean isClusteringOperation(ContainerAllocationTaskState state) { return state.getCustomProperty(RequestUtils.CLUSTERING_OPERATION_CUSTOM_PROP) != null; }
private ContainerAllocationTaskState prepareContainerAllocationTask( ContainerDescription containerDesc, long resourceCount, String placemenStateLink) { String taskLink = buildTaskLink(containerDesc); ContainerAllocationTaskState allocationTask = new ContainerAllocationTaskState(); allocationTask.resourceDescriptionLink = containerDesc.documentSelfLink; allocationTask.groupResourcePlacementLink = placemenStateLink; allocationTask.resourceType = ResourceType.CONTAINER_TYPE.getName(); allocationTask.resourceCount = resourceCount; allocationTask.tenantLinks = containerDesc.tenantLinks; allocationTask.serviceTaskCallback = createServiceCallBack(taskLink); allocationTask.customProperties = new HashMap<>(); return allocationTask; }
private ContainerAllocationTaskState createContainerAllocationTask(String containerDescLink, long resourceCount) { ContainerAllocationTaskState allocationTask = new ContainerAllocationTaskState(); allocationTask.resourceDescriptionLink = containerDescLink; allocationTask.groupResourcePlacementLink = groupPlacementState.documentSelfLink; allocationTask.resourceType = ResourceType.CONTAINER_TYPE.getName(); allocationTask.resourceCount = resourceCount; allocationTask.serviceTaskCallback = ServiceTaskCallback.createEmpty(); allocationTask.customProperties = new HashMap<>(); return allocationTask; }