Search in sources :

Example 1 with VMInformation

use of org.objectweb.proactive.core.runtime.VMInformation in project scheduling by ow2-proactive.

the class InProcessTaskExecutorTest method mockedNodeSet.

private NodeSet mockedNodeSet() {
    NodeSet nodes = new NodeSet();
    ProActiveRuntime proActiveRuntime = mock(ProActiveRuntime.class);
    VMInformation vmInformation = mock(VMInformation.class);
    when(vmInformation.getHostName()).thenReturn("dummyhost");
    when(proActiveRuntime.getVMInformation()).thenReturn(vmInformation);
    nodes.add(new NodeImpl(proActiveRuntime, "dummyhost"));
    return nodes;
}
Also used : NodeSet(org.ow2.proactive.utils.NodeSet) NodeImpl(org.objectweb.proactive.core.node.NodeImpl) VMInformation(org.objectweb.proactive.core.runtime.VMInformation) ProActiveRuntime(org.objectweb.proactive.core.runtime.ProActiveRuntime)

Example 2 with VMInformation

use of org.objectweb.proactive.core.runtime.VMInformation in project scheduling by ow2-proactive.

the class RMNodeHelper method createNode.

private static Node createNode(String name, String hostname, String nodeUrl, String proActiveRuntimeUrl) {
    VMInformation vmInformation = Mockito.mock(VMInformation.class);
    when(vmInformation.getHostName()).thenReturn(hostname);
    NodeInformation nodeInformation = Mockito.mock(NodeInformation.class);
    when(nodeInformation.getName()).thenReturn(name);
    when(nodeInformation.getURL()).thenReturn(nodeUrl);
    when(nodeInformation.getVMInformation()).thenReturn(vmInformation);
    ProActiveRuntime proActiveRuntime = Mockito.mock(ProActiveRuntime.class);
    when(proActiveRuntime.getURL()).thenReturn(proActiveRuntimeUrl);
    Node node = Mockito.mock(Node.class);
    when(node.getNodeInformation()).thenReturn(nodeInformation);
    when(node.getProActiveRuntime()).thenReturn(proActiveRuntime);
    return node;
}
Also used : NodeInformation(org.objectweb.proactive.core.node.NodeInformation) VMInformation(org.objectweb.proactive.core.runtime.VMInformation) Node(org.objectweb.proactive.core.node.Node) ProActiveRuntime(org.objectweb.proactive.core.runtime.ProActiveRuntime)

Example 3 with VMInformation

use of org.objectweb.proactive.core.runtime.VMInformation in project scheduling by ow2-proactive.

the class LiveJobsTest method testFinishInErrorTask.

@Test(timeout = 60000)
public void testFinishInErrorTask() throws UnknownTaskException, UnknownJobException {
    InternalJob job = new InternalTaskFlowJob("test-name", JobPriority.NORMAL, OnTaskError.CONTINUE_JOB_EXECUTION, "description");
    JobId id = new JobIdImpl(666L, "test-name");
    job.setId(id);
    List<InternalTask> tasksList = new ArrayList<>();
    InternalTask internalTask = new InternalScriptTask(job);
    internalTask.setName("task-name");
    internalTask.setStatus(TaskStatus.IN_ERROR);
    Node node = Mockito.mock(Node.class);
    Mockito.when(node.getVMInformation()).thenAnswer(new Answer<VMInformation>() {

        @Override
        public VMInformation answer(InvocationOnMock invocation) throws Throwable {
            return Mockito.mock(VMInformation.class);
        }
    });
    Mockito.when(node.getNodeInformation()).thenAnswer(new Answer<NodeInformation>() {

        @Override
        public NodeInformation answer(InvocationOnMock invocation) throws Throwable {
            return Mockito.mock(NodeInformation.class);
        }
    });
    TaskLauncher taskLauncher = Mockito.mock(TaskLauncher.class);
    internalTask.setExecuterInformation(new ExecuterInformation(taskLauncher, node));
    tasksList.add(internalTask);
    job.setTasks(tasksList);
    liveJobs.jobSubmitted(job);
    liveJobs.finishInErrorTask(job.getId(), "task-name");
    assertThat(internalTask.getStatus(), is(TaskStatus.FINISHED));
}
Also used : ExecuterInformation(org.ow2.proactive.scheduler.task.internal.ExecuterInformation) InternalJob(org.ow2.proactive.scheduler.job.InternalJob) NodeInformation(org.objectweb.proactive.core.node.NodeInformation) InternalTask(org.ow2.proactive.scheduler.task.internal.InternalTask) VMInformation(org.objectweb.proactive.core.runtime.VMInformation) TaskLauncher(org.ow2.proactive.scheduler.task.TaskLauncher) Node(org.objectweb.proactive.core.node.Node) ArrayList(java.util.ArrayList) InternalScriptTask(org.ow2.proactive.scheduler.task.internal.InternalScriptTask) InvocationOnMock(org.mockito.invocation.InvocationOnMock) JobIdImpl(org.ow2.proactive.scheduler.job.JobIdImpl) InternalTaskFlowJob(org.ow2.proactive.scheduler.job.InternalTaskFlowJob) JobId(org.ow2.proactive.scheduler.common.job.JobId) Test(org.junit.Test)

Example 4 with VMInformation

use of org.objectweb.proactive.core.runtime.VMInformation in project scheduling by ow2-proactive.

the class TopologyNodesTest method createMockeNode.

private Node createMockeNode(String hostName) {
    Node node = mock(Node.class);
    String nodeName = hostName + "_" + nodeNameIndex++;
    VMInformation vmInformation = mock(VMInformation.class);
    NodeInformation nodeInformation = mock(NodeInformation.class);
    if (!mockedInetAddresses.containsKey(hostName)) {
        mockedInetAddresses.put(hostName, mock(InetAddress.class));
    }
    InetAddress inetAddress = mockedInetAddresses.get(hostName);
    when(node.getVMInformation()).thenReturn(vmInformation);
    when(node.getNodeInformation()).thenReturn(nodeInformation);
    when(nodeInformation.getVMInformation()).thenReturn(vmInformation);
    when(nodeInformation.getName()).thenReturn(nodeName);
    when(vmInformation.getHostName()).thenReturn(hostName);
    when(vmInformation.getInetAddress()).thenReturn(inetAddress);
    when(inetAddress.getHostName()).thenReturn(hostName);
    when(node.toString()).thenReturn(nodeName);
    return node;
}
Also used : NodeInformation(org.objectweb.proactive.core.node.NodeInformation) VMInformation(org.objectweb.proactive.core.runtime.VMInformation) RMNode(org.ow2.proactive.resourcemanager.rmnode.RMNode) Node(org.objectweb.proactive.core.node.Node) InetAddress(java.net.InetAddress)

Aggregations

VMInformation (org.objectweb.proactive.core.runtime.VMInformation)4 Node (org.objectweb.proactive.core.node.Node)3 NodeInformation (org.objectweb.proactive.core.node.NodeInformation)3 ProActiveRuntime (org.objectweb.proactive.core.runtime.ProActiveRuntime)2 InetAddress (java.net.InetAddress)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1 NodeImpl (org.objectweb.proactive.core.node.NodeImpl)1 RMNode (org.ow2.proactive.resourcemanager.rmnode.RMNode)1 JobId (org.ow2.proactive.scheduler.common.job.JobId)1 InternalJob (org.ow2.proactive.scheduler.job.InternalJob)1 InternalTaskFlowJob (org.ow2.proactive.scheduler.job.InternalTaskFlowJob)1 JobIdImpl (org.ow2.proactive.scheduler.job.JobIdImpl)1 TaskLauncher (org.ow2.proactive.scheduler.task.TaskLauncher)1 ExecuterInformation (org.ow2.proactive.scheduler.task.internal.ExecuterInformation)1 InternalScriptTask (org.ow2.proactive.scheduler.task.internal.InternalScriptTask)1 InternalTask (org.ow2.proactive.scheduler.task.internal.InternalTask)1 NodeSet (org.ow2.proactive.utils.NodeSet)1