use of org.ow2.proactive.resourcemanager.common.event.dto.RMStateFull in project scheduling by ow2-proactive.
the class RMInitialState method cloneAndFilterNotRemovedOnly.
/**
* Clones current state events, but keep only those events which was not removed.
* @return RMStateFull where all the events are correspond to existing node/nodesources
*/
public RMStateFull cloneAndFilterNotRemovedOnly() {
final List<RMEvent> responseEvents = events.getSortedItems().stream().filter(event -> (event.getEventType() != RMEventType.NODE_REMOVED && event.getEventType() != RMEventType.NODESOURCE_REMOVED)).collect(Collectors.toList());
RMStateFull response = new RMStateFull();
response.setNodeSource(getNodeSourceEvents(responseEvents));
response.setNodesEvents(getNodeEvents(responseEvents));
return response;
}
use of org.ow2.proactive.resourcemanager.common.event.dto.RMStateFull in project scheduling by ow2-proactive.
the class RMRest method getModelTokens.
@Override
public String getModelTokens() throws PermissionRestException {
RMStateFull state = orThrowRpe(RMStateCaching.getRMStateFull());
Set<String> tokens = new LinkedHashSet<>();
state.getNodesEvents().forEach(event -> tokens.addAll(event.getTokens()));
if (tokens.isEmpty()) {
return "PA:REGEXP(^$)";
}
return String.format("PA:LIST(,%s)", String.join(",", tokens));
}
use of org.ow2.proactive.resourcemanager.common.event.dto.RMStateFull in project scheduling by ow2-proactive.
the class RMStateCaching method getRMStateFull.
public static RMStateFull getRMStateFull() {
try {
long startTime = System.currentTimeMillis();
final RMStateFull state = PAFuture.getFutureValue(rm.getRMStateFull());
long time = System.currentTimeMillis() - startTime;
logger.debug(String.format("Retrieved RM full state in %d ms", time));
return state;
} catch (Exception e) {
logger.error("Exception occurrend while retrieving full RM state, connection reset", e);
throw e;
}
}
Aggregations