@Override public boolean apply(@Nullable SlotStatus slotStatus) { return slotStatus != null && glob.apply(slotStatus.getAssignment().getConfig()); } }
@Override public boolean apply(@Nullable SlotStatus slotStatus) { return slotStatus != null && glob.apply(slotStatus.getAssignment().getBinary()); } }
private List<ServiceDescriptor> getServiceInventory(SlotStatus slotStatus) Assignment assignment = slotStatus.getAssignment(); if (assignment == null) { return null;
@Override public boolean apply(RemoteAgent agent) { for (RemoteSlot slot : agent.getSlots()) { if (repository.binaryEqualsIgnoreVersion(assignment.getBinary(), slot.status().getAssignment().getBinary()) && repository.configEqualsIgnoreVersion(assignment.getConfig(), slot.status().getAssignment().getConfig())) { return false; } } return true; } };
SlotLifecycleState state = status.getState(); if (state != TERMINATED && state != UNKNOWN) { Assignment assignment = upgradeVersions.upgradeAssignment(repository, status.getAssignment()); newAssignments.add(assignment); slotsToUpgrade.add(slot);
messages.add("Expected state to be " + expectedState.getStatus()); if (!Objects.equal(actualState.getAssignment(), expectedState.getAssignment())) { Assignment assignment = expectedState.getAssignment(); if (assignment != null) {
@Override public SlotStatus apply(RemoteSlot slot) { SlotStatus slotStatus; SlotLifecycleState expectedState; switch (state) { case RUNNING: slotStatus = slot.start(); expectedState = RUNNING; break; case RESTARTING: slotStatus = slot.restart(); expectedState = RUNNING; break; case STOPPED: slotStatus = slot.stop(); expectedState = STOPPED; break; default: throw new IllegalArgumentException("Unexpected state transition " + state); } stateManager.setExpectedState(new ExpectedSlotStatus(slotStatus.getId(), expectedState, slotStatus.getAssignment())); return slotStatus; } }));
@Override public SlotStatus apply(SlotStatus slotStatus) { if (slotStatus.getState() != SlotLifecycleState.UNKNOWN) { stateManager.setExpectedState(new ExpectedSlotStatus(slotStatus.getId(), slotStatus.getState(), slotStatus.getAssignment())); } else { stateManager.deleteExpectedState(slotStatus.getId()); } return slotStatus; } }));
@Override public boolean apply(@Nullable AgentStatus status) { // We can only install on online agents if (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 (repository.binaryEqualsIgnoreVersion(assignment.getBinary(), slot.getAssignment().getBinary()) && repository.configEqualsIgnoreVersion(assignment.getConfig(), slot.getAssignment().getConfig())) { 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; } }
stateManager.setExpectedState(new ExpectedSlotStatus(slotStatus.getId(), slotStatus.getState(), slotStatus.getAssignment()));
String shortBinary = null; String shortConfig = null; if (status.getAssignment() != null) { binary = status.getAssignment().getBinary(); config = status.getAssignment().getConfig(); if (repository != null) { shortBinary = Objects.firstNonNull(repository.binaryRelativize(binary), binary);
String shortBinary = null; String shortConfig = null; if (slotStatus.getAssignment() != null) { binary = slotStatus.getAssignment().getBinary(); config = slotStatus.getAssignment().getConfig(); if (repository != null) { shortBinary = Objects.firstNonNull(repository.binaryRelativize(binary), binary);