Search in sources :

Example 1 with RMProxy

use of org.ow2.proactive.scheduler.core.rmproxies.RMProxy in project scheduling by ow2-proactive.

the class SchedulerStateRecoverHelper method runningTaskMustBeResetToPending.

private boolean runningTaskMustBeResetToPending(InternalTask task, RMProxy rmProxy) {
    boolean resetToPending;
    if (rmProxy != null) {
        NodeSet nodes = task.getExecuterInformation().getNodes();
        boolean taskNodesKnownByRM = rmProxy.areNodesKnown(nodes);
        if (taskNodesKnownByRM) {
            TaskLauncher launcher = task.getExecuterInformation().getLauncher();
            logger.debug("Checking whether task launcher has called its doTask method: " + launcher.isTaskStarted());
            if (launcher.isTaskStarted()) {
                logger.info("Recover running task " + task.getId() + " (" + task.getName() + ") successfully with task launcher " + launcher);
                resetToPending = false;
            } else {
                logger.info(FAIL_TO_RECOVER_RUNNING_TASK_STRING + task.getId() + " (" + task.getName() + ") because its task launcher has not started to execute the task");
                resetToPending = true;
            }
        } else {
            logger.info(FAIL_TO_RECOVER_RUNNING_TASK_STRING + task.getId() + " (" + task.getName() + ") because the task's node is not known by the resource manager");
            resetToPending = true;
        }
    } else {
        logger.info(FAIL_TO_RECOVER_RUNNING_TASK_STRING + task.getId() + " (" + task.getName() + ") because the resource manager is not reachable");
        resetToPending = true;
    }
    return resetToPending;
}
Also used : NodeSet(org.ow2.proactive.utils.NodeSet) TaskLauncher(org.ow2.proactive.scheduler.task.TaskLauncher)

Example 2 with RMProxy

use of org.ow2.proactive.scheduler.core.rmproxies.RMProxy in project scheduling by ow2-proactive.

the class TestRMProxy method checkSchedulerProxy.

private void checkSchedulerProxy(RMProxiesManager proxiesManager) {
    log("Check scheduler proxy");
    RMProxy proxy = proxiesManager.getRmProxy();
    assertEquals(proxy.getState().getFreeNodesNumber(), NODES_NUMBER);
    assertTrue(proxy.isActive().getBooleanValue());
}
Also used : RMProxy(org.ow2.proactive.scheduler.core.rmproxies.RMProxy)

Example 3 with RMProxy

use of org.ow2.proactive.scheduler.core.rmproxies.RMProxy in project scheduling by ow2-proactive.

the class TestRMProxy method requestWithExtraNodes.

private void requestWithExtraNodes(RMProxy proxy, ResourceManager rm) throws Exception {
    log("Request NodeSet with extra nodes");
    TopologyDescriptor topology = TopologyDescriptor.SINGLE_HOST_EXCLUSIVE;
    Criteria criteria = new Criteria(1);
    criteria.setTopology(topology);
    NodeSet nodeSet = proxy.getNodes(criteria);
    PAFuture.waitFor(nodeSet);
    assertEquals(1, nodeSet.size());
    Assert.assertNotNull("Extra nodes are expected", nodeSet.getExtraNodes());
    assertEquals(NODES_NUMBER - 1, nodeSet.getExtraNodes().size());
    assertEquals(0, rm.getState().getFreeNodesNumber());
    proxy.releaseNodes(nodeSet);
    waitWhenNodesAreReleased(NODES_NUMBER);
    assertEquals(NODES_NUMBER, rm.getState().getFreeNodesNumber());
}
Also used : NodeSet(org.ow2.proactive.utils.NodeSet) Criteria(org.ow2.proactive.utils.Criteria) TopologyDescriptor(org.ow2.proactive.topology.descriptor.TopologyDescriptor)

Example 4 with RMProxy

use of org.ow2.proactive.scheduler.core.rmproxies.RMProxy in project scheduling by ow2-proactive.

the class TestRMProxy method requestReleaseAllNodes.

private void requestReleaseAllNodes(RMProxy proxy, ResourceManager rm) throws Exception {
    log("Request and release all nodes");
    List<NodeSet> nodeSets = new ArrayList<>();
    for (int i = 0; i < NODES_NUMBER; i++) {
        nodeSets.add(proxy.getNodes(new Criteria(1)));
    }
    for (NodeSet nodeSet : nodeSets) {
        waitWhenNodeSetAcquired(nodeSet, 1);
        proxy.releaseNodes(nodeSet);
    }
    waitWhenNodesAreReleased(NODES_NUMBER);
    assertEquals(NODES_NUMBER, rm.getState().getFreeNodesNumber());
}
Also used : NodeSet(org.ow2.proactive.utils.NodeSet) ArrayList(java.util.ArrayList) Criteria(org.ow2.proactive.utils.Criteria)

Example 5 with RMProxy

use of org.ow2.proactive.scheduler.core.rmproxies.RMProxy in project scheduling by ow2-proactive.

the class TestRMProxy method testSplitNodeSet.

private void testSplitNodeSet(RMProxy proxy, ResourceManager rm) throws Exception {
    log("Request as single NodeSet, release it as two NodeSets");
    NodeSet nodeSet = proxy.getNodes(new Criteria(3));
    waitWhenNodeSetAcquired(nodeSet, 3);
    assertEquals(NODES_NUMBER - 3, rm.getState().getFreeNodesNumber());
    NodeSet nodeSet1 = new NodeSet();
    nodeSet1.add(nodeSet.remove(0));
    NodeSet nodeSet2 = new NodeSet();
    nodeSet2.add(nodeSet.remove(0));
    nodeSet2.add(nodeSet.remove(0));
    proxy.releaseNodes(nodeSet1);
    waitWhenNodesAreReleased(1);
    assertEquals(NODES_NUMBER - 2, rm.getState().getFreeNodesNumber());
    proxy.releaseNodes(nodeSet2);
    waitWhenNodesAreReleased(2);
    assertEquals(NODES_NUMBER, rm.getState().getFreeNodesNumber());
}
Also used : NodeSet(org.ow2.proactive.utils.NodeSet) Criteria(org.ow2.proactive.utils.Criteria)

Aggregations

NodeSet (org.ow2.proactive.utils.NodeSet)9 Criteria (org.ow2.proactive.utils.Criteria)7 RMProxy (org.ow2.proactive.scheduler.core.rmproxies.RMProxy)4 Credentials (org.ow2.proactive.authentication.crypto.Credentials)3 InternalTask (org.ow2.proactive.scheduler.task.internal.InternalTask)3 ExecutorService (java.util.concurrent.ExecutorService)2 CredData (org.ow2.proactive.authentication.crypto.CredData)2 PerUserConnectionRMProxiesManager (org.ow2.proactive.scheduler.core.rmproxies.PerUserConnectionRMProxiesManager)2 RMProxiesManager (org.ow2.proactive.scheduler.core.rmproxies.RMProxiesManager)2 SingleConnectionRMProxiesManager (org.ow2.proactive.scheduler.core.rmproxies.SingleConnectionRMProxiesManager)2 InternalJob (org.ow2.proactive.scheduler.job.InternalJob)2 RMMonitorEventReceiver (functionaltests.monitor.RMMonitorEventReceiver)1 RMMonitorsHandler (functionaltests.monitor.RMMonitorsHandler)1 URI (java.net.URI)1 KeyException (java.security.KeyException)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Vector (java.util.Vector)1 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)1 ScheduledThreadPoolExecutor (java.util.concurrent.ScheduledThreadPoolExecutor)1