Search in sources :

Example 1 with RMStateFull

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;
}
Also used : RMStateDelta(org.ow2.proactive.resourcemanager.common.event.dto.RMStateDelta) Collection(java.util.Collection) XmlRootElement(javax.xml.bind.annotation.XmlRootElement) Collectors(java.util.stream.Collectors) Serializable(java.io.Serializable) RMStateFull(org.ow2.proactive.resourcemanager.common.event.dto.RMStateFull) PAResourceManagerProperties(org.ow2.proactive.resourcemanager.core.properties.PAResourceManagerProperties) RMEventListener(org.ow2.proactive.resourcemanager.frontend.RMEventListener) AtomicLong(java.util.concurrent.atomic.AtomicLong) Logger(org.apache.log4j.Logger) List(java.util.List) Optional(java.util.Optional) Comparator(java.util.Comparator) PublicAPI(org.objectweb.proactive.annotation.PublicAPI) RMMonitoring(org.ow2.proactive.resourcemanager.frontend.RMMonitoring) RMStateFull(org.ow2.proactive.resourcemanager.common.event.dto.RMStateFull)

Example 2 with RMStateFull

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));
}
Also used : RMStateFull(org.ow2.proactive.resourcemanager.common.event.dto.RMStateFull)

Example 3 with RMStateFull

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;
    }
}
Also used : RMStateFull(org.ow2.proactive.resourcemanager.common.event.dto.RMStateFull)

Aggregations

RMStateFull (org.ow2.proactive.resourcemanager.common.event.dto.RMStateFull)3 Serializable (java.io.Serializable)1 Collection (java.util.Collection)1 Comparator (java.util.Comparator)1 List (java.util.List)1 Optional (java.util.Optional)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 Collectors (java.util.stream.Collectors)1 XmlRootElement (javax.xml.bind.annotation.XmlRootElement)1 Logger (org.apache.log4j.Logger)1 PublicAPI (org.objectweb.proactive.annotation.PublicAPI)1 RMStateDelta (org.ow2.proactive.resourcemanager.common.event.dto.RMStateDelta)1 PAResourceManagerProperties (org.ow2.proactive.resourcemanager.core.properties.PAResourceManagerProperties)1 RMEventListener (org.ow2.proactive.resourcemanager.frontend.RMEventListener)1 RMMonitoring (org.ow2.proactive.resourcemanager.frontend.RMMonitoring)1