if (!InstallationUtils.resourcesAreAvailable(availableResources, installation.getResources())) { continue;
@Override public Deployment install(Installation installation) { Preconditions.checkNotNull(installation, "installation is null"); deployment = new Deployment(UUID.randomUUID(), location, new File("installation"), new File("data"), installation.getAssignment(), installation.getResources()); return deployment; }
public static InstallationRepresentation from(Installation installation) { Assignment assignment = installation.getAssignment(); return new InstallationRepresentation( installation.getShortName(), AssignmentRepresentation.from(assignment), installation.getBinaryFile().toString(), installation.getConfigFile().toString(), installation.getResources()); }
@Override public Deployment install(Installation installation) { Preconditions.checkNotNull(installation, "installation is null"); deployment = new Deployment(UUID.randomUUID(), location, new File("installation"), new File("data"), installation.getAssignment(), installation.getResources()); return deployment; }
Deployment newDeployment = new Deployment(slotId, location, deploymentDir, getDataDir(), assignment, installation.getResources()); File tempDir = createTempDir(baseDir, "tmp-install"); try {
@Override public boolean apply(@Nullable AgentStatus status) { // We can only install on online agents if ((status == null) || (status.getState() != ONLINE)) { return false; } // Constraints: normally we only allow only instance of a binary+config on each agent if (!allowDuplicateInstallationsOnAnAgent) { for (SlotStatus slot : status.getSlotStatuses()) { if ((slot.getAssignment() != null) && assignmentEqualsIgnoreVersion(slot.getAssignment())) { return false; } } } // agents without declared resources are considered to have unlimited resources if (!status.getResources().isEmpty()) { // verify that required resources are available Installation installation = toInstallation(repository, assignment); Map<String, Integer> availableResources = getAvailableResources(status); if (!resourcesAreAvailable(availableResources, installation.getResources())) { return false; } } return true; }
@Override public synchronized SlotStatus install(Installation installation) { checkNotNull(installation, "installation is null"); AgentStatus agentStatus = getAgentStatus(); Preconditions.checkState(agentStatus.getState() != OFFLINE, "agent is offline"); UUID slotId = UUID.randomUUID(); SlotStatus slotStatus = createSlotStatus(slotId, uriBuilderFrom(agentStatus.getInternalUri()).appendPath("slot").appendPath(slotId.toString()).build(), uriBuilderFrom(agentStatus.getExternalUri()).appendPath("slot").appendPath(slotId.toString()).build(), "instance", "/location", SlotLifecycleState.STOPPED, installation.getAssignment(), "/" + slotId, installation.getResources()); agentStatus.changeSlotStatus(slotStatus); return slotStatus; }
@Override public synchronized SlotStatus install(Installation installation) { checkNotNull(installation, "installation is null"); AgentStatus agentStatus = getAgentStatus(); Preconditions.checkState(agentStatus.getState() != OFFLINE, "agent is offline"); UUID slotId = UUID.randomUUID(); SlotStatus slotStatus = createSlotStatus(slotId, uriBuilderFrom(agentStatus.getInternalUri()).appendPath("slot").appendPath(slotId.toString()).build(), uriBuilderFrom(agentStatus.getExternalUri()).appendPath("slot").appendPath(slotId.toString()).build(), "instance", "/location", SlotLifecycleState.STOPPED, installation.getAssignment(), "/" + slotId, installation.getResources()); agentStatus.changeSlotStatus(slotStatus); return slotStatus; }