Search in sources :

Example 11 with Criteria

use of org.ow2.proactive.utils.Criteria in project scheduling by ow2-proactive.

the class TestLoadJobs method setUp.

@Before
public void setUp() throws Exception {
    logger.setLevel(Level.INFO);
    Scheduler scheduler = schedulerHelper.getSchedulerInterface();
    List<JobInfo> jobs = scheduler.getJobs(0, 1000, criteria(true, true, true, true), SORT_BY_ID_ASC).getList();
    for (JobInfo job : jobs) {
        scheduler.removeJob(job.getJobId());
    }
}
Also used : JobInfo(org.ow2.proactive.scheduler.common.job.JobInfo) Scheduler(org.ow2.proactive.scheduler.common.Scheduler) Before(org.junit.Before)

Example 12 with Criteria

use of org.ow2.proactive.utils.Criteria 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 13 with Criteria

use of org.ow2.proactive.utils.Criteria 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 14 with Criteria

use of org.ow2.proactive.utils.Criteria 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)

Example 15 with Criteria

use of org.ow2.proactive.utils.Criteria in project scheduling by ow2-proactive.

the class SelectionManagerTest method testSelectNodesWith10Node.

@Test
public void testSelectNodesWith10Node() {
    RMCore rmCore = newMockedRMCore(10);
    SelectionManager selectionManager = createSelectionManager(rmCore);
    Criteria crit = new Criteria(10);
    crit.setTopology(TopologyDescriptor.ARBITRARY);
    crit.setScripts(null);
    crit.setBlackList(null);
    crit.setBestEffort(true);
    Client mockedClient = mock(Client.class);
    NodeSet nodeSet = selectionManager.selectNodes(crit, mockedClient);
    assertEquals(10, nodeSet.size());
}
Also used : RMCore(org.ow2.proactive.resourcemanager.core.RMCore) NodeSet(org.ow2.proactive.utils.NodeSet) Criteria(org.ow2.proactive.utils.Criteria) Client(org.ow2.proactive.resourcemanager.authentication.Client) Test(org.junit.Test)

Aggregations

Criteria (org.ow2.proactive.utils.Criteria)25 NodeSet (org.ow2.proactive.utils.NodeSet)23 Test (org.junit.Test)16 Node (org.objectweb.proactive.core.node.Node)9 RMFunctionalTest (functionaltests.utils.RMFunctionalTest)7 ArrayList (java.util.ArrayList)7 RMCore (org.ow2.proactive.resourcemanager.core.RMCore)6 RMNode (org.ow2.proactive.resourcemanager.rmnode.RMNode)6 CredData (org.ow2.proactive.authentication.crypto.CredData)5 Credentials (org.ow2.proactive.authentication.crypto.Credentials)5 ResourceManager (org.ow2.proactive.resourcemanager.frontend.ResourceManager)5 Client (org.ow2.proactive.resourcemanager.authentication.Client)4 Scheduler (org.ow2.proactive.scheduler.common.Scheduler)4 LinkedList (java.util.LinkedList)3 RMAuthentication (org.ow2.proactive.resourcemanager.authentication.RMAuthentication)3 RMState (org.ow2.proactive.resourcemanager.common.RMState)3 JobInfo (org.ow2.proactive.scheduler.common.job.JobInfo)3 PublicKey (java.security.PublicKey)2 HashMap (java.util.HashMap)2 List (java.util.List)2