Search in sources :

Example 1 with BooleanWrapper

use of org.objectweb.proactive.core.util.wrapper.BooleanWrapper in project scheduling by ow2-proactive.

the class RMRestTest method testShutdown_PreemptParameter.

@Test
public void testShutdown_PreemptParameter() throws Exception {
    RMProxyUserInterface rm = mock(RMProxyUserInterface.class);
    when(rm.shutdown(true)).thenReturn(new BooleanWrapper(true));
    String sessionId = SharedSessionStoreTestUtils.createValidSession(rm);
    HttpResponse response = callHttpGetMethod("shutdown?preempt=true", sessionId);
    assertEquals(HttpURLConnection.HTTP_OK, response.getStatusLine().getStatusCode());
    verify(rm).shutdown(true);
}
Also used : BooleanWrapper(org.objectweb.proactive.core.util.wrapper.BooleanWrapper) RMProxyUserInterface(org.ow2.proactive.resourcemanager.common.util.RMProxyUserInterface) HttpResponse(org.apache.http.HttpResponse) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Example 2 with BooleanWrapper

use of org.objectweb.proactive.core.util.wrapper.BooleanWrapper in project scheduling by ow2-proactive.

the class RMNodeStarter method closeDataSpaceOnShutdown.

private void closeDataSpaceOnShutdown(final Node node) {
    Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {

        @Override
        public void run() {
            try {
                DataSpaceNodeConfigurationAgent conf = (DataSpaceNodeConfigurationAgent) PAActiveObject.newActive(DataSpaceNodeConfigurationAgent.class.getName(), null, node);
                BooleanWrapper closeNodeConfiguration = conf.closeNodeConfiguration();
                PAFuture.waitFor(closeNodeConfiguration, DATASPACE_CLOSE_TIMEOUT);
                if (closeNodeConfiguration.getBooleanValue()) {
                    logger.debug("Dataspaces are successfully closed for node " + node.getNodeInformation().getURL());
                }
            } catch (Throwable t) {
                logger.debug("Cannot close data spaces configuration", t);
            }
        }
    }));
}
Also used : BooleanWrapper(org.objectweb.proactive.core.util.wrapper.BooleanWrapper) DataSpaceNodeConfigurationAgent(org.ow2.proactive.resourcemanager.nodesource.dataspace.DataSpaceNodeConfigurationAgent)

Example 3 with BooleanWrapper

use of org.objectweb.proactive.core.util.wrapper.BooleanWrapper in project scheduling by ow2-proactive.

the class ReleaseResourcesWhenSchedulerIdle method activate.

@Override
public BooleanWrapper activate() {
    BooleanWrapper activationStatus = super.activate();
    if (!activationStatus.getBooleanValue()) {
        return activationStatus;
    }
    activeJobs = state.getPendingJobs().size() + state.getRunningJobs().size();
    debug("Policy is activated. Current number of jobs is " + activeJobs);
    return new BooleanWrapper(true);
}
Also used : BooleanWrapper(org.objectweb.proactive.core.util.wrapper.BooleanWrapper)

Example 4 with BooleanWrapper

use of org.objectweb.proactive.core.util.wrapper.BooleanWrapper in project scheduling by ow2-proactive.

the class RMCore method removeNodeSource.

/**
 * {@inheritDoc}
 */
public BooleanWrapper removeNodeSource(String nodeSourceName, boolean preempt) {
    if (!this.definedNodeSources.containsKey(nodeSourceName)) {
        throw new IllegalArgumentException("Unknown node source " + nodeSourceName);
    }
    NodeSource nodeSourceToRemove = this.definedNodeSources.get(nodeSourceName);
    this.caller.checkPermission(nodeSourceToRemove.getAdminPermission(), this.caller + " is not authorized to remove " + nodeSourceName);
    logger.info("Remove node source " + nodeSourceName + " with preempt=" + preempt + REQUESTED_BY_STRING + this.caller.getName());
    this.shutDownNodeSourceIfDeployed(nodeSourceName, preempt);
    this.removeDefinedNodeSource(nodeSourceName, nodeSourceToRemove);
    return new BooleanWrapper(true);
}
Also used : NodeSource(org.ow2.proactive.resourcemanager.nodesource.NodeSource) BooleanWrapper(org.objectweb.proactive.core.util.wrapper.BooleanWrapper)

Example 5 with BooleanWrapper

use of org.objectweb.proactive.core.util.wrapper.BooleanWrapper in project scheduling by ow2-proactive.

the class RMCore method nodeSourceUnregister.

/**
 * Unregisters node source from the resource manager core.
 */
public BooleanWrapper nodeSourceUnregister(String nodeSourceName, NodeSourceStatus nodeSourceStatus, RMNodeSourceEvent evt) {
    NodeSource nodeSource = this.deployedNodeSources.remove(nodeSourceName);
    if (nodeSource == null) {
        logger.warn("Attempt to remove non-existing node source " + nodeSourceName);
        return new BooleanWrapper(false);
    }
    this.disconnectNodeSourceClient(nodeSourceName, nodeSource);
    logger.info(NODE_SOURCE_STRING + nodeSourceName + " has been successfully " + evt.getEventType().getDescription());
    this.monitoring.nodeSourceEvent(evt);
    this.emitRemovedEventIfNodeSourceWasNotUndeployed(nodeSource, nodeSourceStatus);
    if ((this.deployedNodeSources.isEmpty()) && this.toShutDown) {
        this.finalizeShutdown();
    }
    return new BooleanWrapper(true);
}
Also used : NodeSource(org.ow2.proactive.resourcemanager.nodesource.NodeSource) BooleanWrapper(org.objectweb.proactive.core.util.wrapper.BooleanWrapper)

Aggregations

BooleanWrapper (org.objectweb.proactive.core.util.wrapper.BooleanWrapper)36 RMNode (org.ow2.proactive.resourcemanager.rmnode.RMNode)10 Test (org.junit.Test)9 NodeSource (org.ow2.proactive.resourcemanager.nodesource.NodeSource)7 Matchers.anyString (org.mockito.Matchers.anyString)5 Node (org.objectweb.proactive.core.node.Node)5 HashSet (java.util.HashSet)4 Client (org.ow2.proactive.resourcemanager.authentication.Client)4 RMNodeSourceEvent (org.ow2.proactive.resourcemanager.common.event.RMNodeSourceEvent)4 RMDeployingNode (org.ow2.proactive.resourcemanager.rmnode.RMDeployingNode)4 NodeSet (org.ow2.proactive.utils.NodeSet)4 RMMonitorEventReceiver (functionaltests.monitor.RMMonitorEventReceiver)3 RMFunctionalTest (functionaltests.utils.RMFunctionalTest)3 RMProxyUserInterface (org.ow2.proactive.resourcemanager.common.util.RMProxyUserInterface)3 RMTHelper (functionaltests.utils.RMTHelper)2 HashMap (java.util.HashMap)2 LinkedList (java.util.LinkedList)2 HttpResponse (org.apache.http.HttpResponse)2 ProActiveTimeoutException (org.objectweb.proactive.core.ProActiveTimeoutException)2 RMNodeImpl (org.ow2.proactive.resourcemanager.rmnode.RMNodeImpl)2