Search in sources :

Example 21 with Command

use of org.ow2.proactive_grid_cloud_portal.cli.cmd.Command in project scheduling by ow2-proactive.

the class SchedulingServiceTest2 method createTestJob.

private TaskFlowJob createTestJob() throws Exception {
    TaskFlowJob job = new TaskFlowJob();
    job.setName(this.getClass().getSimpleName());
    JavaTask task1 = new JavaTask();
    task1.setName("javaTask");
    task1.setExecutableClassName("class");
    task1.setOnTaskError(OnTaskError.CANCEL_JOB);
    job.addTask(task1);
    NativeTask task2 = new NativeTask();
    task2.setName("nativeTask");
    task2.setCommandLine("command line");
    task2.setOnTaskError(OnTaskError.CANCEL_JOB);
    job.addTask(task2);
    return job;
}
Also used : TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) JavaTask(org.ow2.proactive.scheduler.common.task.JavaTask) NativeTask(org.ow2.proactive.scheduler.common.task.NativeTask)

Example 22 with Command

use of org.ow2.proactive_grid_cloud_portal.cli.cmd.Command in project scheduling by ow2-proactive.

the class InfrastructureManagerTest method testUpdateDeployingNodeKnown.

@Test
public void testUpdateDeployingNodeKnown() {
    RMDeployingNode rmNode = new RMDeployingNode("deploying", nodeSource, "command", null);
    infrastructureManager.addDeployingNodeWithLockAndPersist(rmNode.getNodeURL(), rmNode);
    assertThat(infrastructureManager.getDeployingNodesWithLock()).hasSize(1);
    assertThat(infrastructureManager.getPersistedDeployingNodesUrl()).hasSize(1);
    assertThat(infrastructureManager.getLostNodesWithLock()).hasSize(0);
    assertThat(infrastructureManager.getPersistedLostNodesUrl()).hasSize(0);
    RMDeployingNode rmNode2 = new RMDeployingNode("deploying", nodeSource, "command2", null);
    RMDeployingNode oldRmNode = infrastructureManager.update(rmNode2);
    assertThat(oldRmNode).isSameAs(rmNode);
    assertThat(infrastructureManager.getDeployingNodesWithLock()).hasSize(1);
    assertThat(infrastructureManager.getPersistedDeployingNodesUrl()).hasSize(1);
    assertThat(infrastructureManager.getLostNodesWithLock()).hasSize(0);
    assertThat(infrastructureManager.getPersistedLostNodesUrl()).hasSize(0);
    assertThat(infrastructureManager.getDeployingNodesWithLock()).contains(rmNode2);
}
Also used : RMDeployingNode(org.ow2.proactive.resourcemanager.rmnode.RMDeployingNode) Test(org.junit.Test)

Example 23 with Command

use of org.ow2.proactive_grid_cloud_portal.cli.cmd.Command in project scheduling by ow2-proactive.

the class InfrastructureManagerTest method testUpdateLostNodeKnown.

@Test
public void testUpdateLostNodeKnown() {
    RMDeployingNode deployingNode = new RMDeployingNode("deploying", nodeSource, "command", null);
    infrastructureManager.addDeployingNodeWithLockAndPersist(deployingNode.getNodeURL(), deployingNode);
    RMDeployingNode lostNode = new RMDeployingNode("lost", nodeSource, "command", null);
    lostNode.setLost();
    infrastructureManager.addLostNodeWithLockAndPersist(lostNode.getNodeURL(), lostNode);
    assertThat(infrastructureManager.getDeployingNodesWithLock()).hasSize(1);
    assertThat(infrastructureManager.getPersistedDeployingNodesUrl()).hasSize(1);
    assertThat(infrastructureManager.getLostNodesWithLock()).hasSize(1);
    assertThat(infrastructureManager.getPersistedLostNodesUrl()).hasSize(1);
    RMDeployingNode lostNode2 = new RMDeployingNode("lost", nodeSource, "command2", null);
    lostNode2.setLost();
    RMDeployingNode oldRmNode = infrastructureManager.update(lostNode2);
    assertThat(oldRmNode).isSameAs(lostNode);
    assertThat(infrastructureManager.getDeployingNodesWithLock()).hasSize(1);
    assertThat(infrastructureManager.getPersistedDeployingNodesUrl()).hasSize(1);
    assertThat(infrastructureManager.getLostNodesWithLock()).hasSize(1);
    assertThat(infrastructureManager.getPersistedLostNodesUrl()).hasSize(1);
    assertThat(infrastructureManager.getLostNodesWithLock()).contains(lostNode2);
    assertThat(infrastructureManager.getPersistedLostNodesUrl()).contains(lostNode.getNodeURL());
    assertThat(infrastructureManager.getPersistedLostNodesUrl()).contains(lostNode2.getNodeURL());
}
Also used : RMDeployingNode(org.ow2.proactive.resourcemanager.rmnode.RMDeployingNode) Test(org.junit.Test)

Example 24 with Command

use of org.ow2.proactive_grid_cloud_portal.cli.cmd.Command in project scheduling by ow2-proactive.

the class InfrastructureManagerTest method testUpdateUnknownNode.

@Test
public void testUpdateUnknownNode() {
    RMDeployingNode rmNode = new RMDeployingNode("deploying", nodeSource, "command", null);
    assertThat(infrastructureManager.getDeployingNodesWithLock()).hasSize(0);
    assertThat(infrastructureManager.getPersistedDeployingNodesUrl()).hasSize(0);
    assertThat(infrastructureManager.getLostNodesWithLock()).hasSize(0);
    assertThat(infrastructureManager.getPersistedLostNodesUrl()).hasSize(0);
    RMDeployingNode oldRmNode = infrastructureManager.update(rmNode);
    assertThat(infrastructureManager.getDeployingNodesWithLock()).hasSize(0);
    assertThat(infrastructureManager.getPersistedDeployingNodesUrl()).hasSize(0);
    assertThat(infrastructureManager.getLostNodesWithLock()).hasSize(0);
    assertThat(infrastructureManager.getPersistedLostNodesUrl()).hasSize(0);
    assertThat(oldRmNode).isNull();
}
Also used : RMDeployingNode(org.ow2.proactive.resourcemanager.rmnode.RMDeployingNode) Test(org.junit.Test)

Example 25 with Command

use of org.ow2.proactive_grid_cloud_portal.cli.cmd.Command in project scheduling by ow2-proactive.

the class InfrastructureManagerTest method testGetDeployingNodeUnknownNode.

@Test
public void testGetDeployingNodeUnknownNode() {
    RMDeployingNode rmNode = new RMDeployingNode("deploying", nodeSource, "command", null);
    assertThat(infrastructureManager.getDeployingNodesWithLock()).hasSize(0);
    assertThat(infrastructureManager.getPersistedDeployingNodesUrl()).hasSize(0);
    assertThat(infrastructureManager.getLostNodesWithLock()).hasSize(0);
    assertThat(infrastructureManager.getPersistedLostNodesUrl()).hasSize(0);
    RMDeployingNode rmNodeFound = infrastructureManager.getDeployingOrLostNode(rmNode.getNodeURL());
    assertThat(rmNodeFound).isNull();
}
Also used : RMDeployingNode(org.ow2.proactive.resourcemanager.rmnode.RMDeployingNode) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)12 IOException (java.io.IOException)11 RMDeployingNode (org.ow2.proactive.resourcemanager.rmnode.RMDeployingNode)10 Throwables.getStackTraceAsString (com.google.common.base.Throwables.getStackTraceAsString)9 ArrayList (java.util.ArrayList)9 RMException (org.ow2.proactive.resourcemanager.exception.RMException)9 TaskFlowJob (org.ow2.proactive.scheduler.common.job.TaskFlowJob)9 NativeTask (org.ow2.proactive.scheduler.common.task.NativeTask)9 KeyException (java.security.KeyException)8 File (java.io.File)7 ForkEnvironment (org.ow2.proactive.scheduler.common.task.ForkEnvironment)6 JobCreationException (org.ow2.proactive.scheduler.common.exception.JobCreationException)5 CommandLineBuilder (org.ow2.proactive.resourcemanager.utils.CommandLineBuilder)4 JavaTask (org.ow2.proactive.scheduler.common.task.JavaTask)4 UnknownHostException (java.net.UnknownHostException)3 Client (org.ow2.proactive.resourcemanager.authentication.Client)3 Command (org.ow2.proactive_grid_cloud_portal.cli.cmd.Command)3 InetAddress (java.net.InetAddress)2 Properties (java.util.Properties)2 ExecutionException (java.util.concurrent.ExecutionException)2