Search in sources :

Example 81 with InternalTask

use of org.ow2.proactive.scheduler.task.internal.InternalTask in project scheduling by ow2-proactive.

the class TagTest method createReplicateTask.

private InternalScriptTask createReplicateTask(String name, InternalTask[] dependences, FlowBlock block, String matchingBlock, int nbRuns) throws InvalidScriptException {
    InternalScriptTask result = createTask(name, dependences, block, matchingBlock);
    FlowScript replicate = FlowScript.createReplicateFlowScript("runs = " + nbRuns + ";");
    result.setFlowScript(replicate);
    return result;
}
Also used : InternalScriptTask(org.ow2.proactive.scheduler.task.internal.InternalScriptTask) FlowScript(org.ow2.proactive.scheduler.common.task.flow.FlowScript)

Example 82 with InternalTask

use of org.ow2.proactive.scheduler.task.internal.InternalTask in project scheduling by ow2-proactive.

the class TagTest method testReplicationReplicateTag.

@Test
public void testReplicationReplicateTag() throws Exception {
    InternalTask task1 = createReplicateTask("T1", null, null, null, 3);
    InternalTask task2 = createTask("T2", new InternalTask[] { task1 }, null, null);
    InternalTask task3 = createTask("T3", new InternalTask[] { task2 }, null, null);
    execute(task1);
    assertNull(job.getTask("T2").getTag());
    assertEquals("REPLICATE-T1-1", job.getTask("T2*1").getTag());
    assertEquals("REPLICATE-T1-2", job.getTask("T2*2").getTag());
}
Also used : InternalTask(org.ow2.proactive.scheduler.task.internal.InternalTask) Test(org.junit.Test) ProActiveTest(org.ow2.tests.ProActiveTest)

Example 83 with InternalTask

use of org.ow2.proactive.scheduler.task.internal.InternalTask in project scheduling by ow2-proactive.

the class TagTest method execute.

private void execute(InternalTask task) {
    task.setExecuterInformation(executerInformationMock);
    job.startTask(task);
    FlowScript script = task.getFlowScript();
    FlowAction action = null;
    if (script != null) {
        action = task.getFlowScript().execute().getResult();
    }
    job.terminateTask(false, task.getId(), schedulerStateUpdateMock, action, resultMock);
    System.out.println("executed " + task.getName() + " -> " + getTaskNameList(true));
}
Also used : FlowAction(org.ow2.proactive.scheduler.common.task.flow.FlowAction) FlowScript(org.ow2.proactive.scheduler.common.task.flow.FlowScript)

Example 84 with InternalTask

use of org.ow2.proactive.scheduler.task.internal.InternalTask in project scheduling by ow2-proactive.

the class TagTest method testReplicationLoopTag.

@Test
public void testReplicationLoopTag() throws Exception {
    InternalTask task1 = createTask("T1", null, FlowBlock.START, "T3");
    InternalTask task2 = createTask("T2", new InternalTask[] { task1 }, null, null);
    InternalTask task3 = createLoopTask("T3", "loop = true;", new InternalTask[] { task2 }, "T1", true);
    execute(new String[] { "T1", "T2", "T3", "T1#1", "T2#1", "T3#1" });
    assertTags("LOOP-T3-1", new String[] { "T1#1", "T2#1", "T3#1" });
    assertTags("LOOP-T3-2", new String[] { "T1#2", "T2#2", "T3#2" });
}
Also used : InternalTask(org.ow2.proactive.scheduler.task.internal.InternalTask) Test(org.junit.Test) ProActiveTest(org.ow2.tests.ProActiveTest)

Example 85 with InternalTask

use of org.ow2.proactive.scheduler.task.internal.InternalTask in project scheduling by ow2-proactive.

the class TagTest method testTaskLogger.

/*
     * @Test
     * public void testReplicationLoopDoubleTag() throws Exception {
     * InternalTask T1 = createTask("T1", null, FlowBlock.START, "T5");
     * InternalTask T2 = createTask("T2", new InternalTask[]{T1}, FlowBlock.START, "T4");
     * InternalTask T3 = createTask("T3", new InternalTask[]{T2}, null, null);
     * InternalTask T4 = createLoopTask("T4", "loop = true;", new InternalTask[]{T3}, "T2", true);
     * InternalTask T5 = createLoopTask("T5", "loop = true;", new InternalTask[]{T4}, "T1", true);
     * 
     * job.getJobDescriptor().getEligibleTasks();
     * 
     * 
     * execute(new String[]{"T5"});
     * 
     * assertTags("REPLICATE-T1-1", new String[]{"T2*1", "T3*1", "T4*1", "T5*1", "T6*1"});
     * assertTags("REPLICATE-T1-2", new String[]{"T2*2", "T3*2", "T4*2", "T5*2", "T6*2"});
     * assertTags("REPLICATE-T2*1-3", new String[]{"T3*3", "T4*3", "T5*3"});
     * assertTags("REPLICATE-T2*1-4", new String[]{"T3*4", "T4*4", "T5*4"});
     * assertTags("REPLICATE-T2*2-5", new String[]{"T3*5", "T4*5", "T5*5"});
     * assertTags("REPLICATE-T2*2-6", new String[]{"T3*6", "T4*6", "T5*6"});
     * }
     */
@Test
public void testTaskLogger() throws InvalidScriptException, UnknownTaskException {
    InternalScriptTask task1 = createLoopTask("T1", "loop = true;", null, "T1", false);
    TaskLogger.getInstance().info(job.getTask("T1").getId(), "a message");
}
Also used : InternalScriptTask(org.ow2.proactive.scheduler.task.internal.InternalScriptTask) Test(org.junit.Test) ProActiveTest(org.ow2.tests.ProActiveTest)

Aggregations

InternalTask (org.ow2.proactive.scheduler.task.internal.InternalTask)142 InternalJob (org.ow2.proactive.scheduler.job.InternalJob)74 Test (org.junit.Test)72 InternalScriptTask (org.ow2.proactive.scheduler.task.internal.InternalScriptTask)39 TaskId (org.ow2.proactive.scheduler.common.task.TaskId)37 TaskResultImpl (org.ow2.proactive.scheduler.task.TaskResultImpl)32 InternalTaskFlowJob (org.ow2.proactive.scheduler.job.InternalTaskFlowJob)31 ArrayList (java.util.ArrayList)30 JobIdImpl (org.ow2.proactive.scheduler.job.JobIdImpl)25 JobId (org.ow2.proactive.scheduler.common.job.JobId)22 TaskFlowJob (org.ow2.proactive.scheduler.common.job.TaskFlowJob)18 ExecuterInformation (org.ow2.proactive.scheduler.task.internal.ExecuterInformation)16 TaskInfoImpl (org.ow2.proactive.scheduler.task.TaskInfoImpl)13 UnknownTaskException (org.ow2.proactive.scheduler.common.exception.UnknownTaskException)12 HashMap (java.util.HashMap)10 UnknownJobException (org.ow2.proactive.scheduler.common.exception.UnknownJobException)10 ProActiveTest (org.ow2.tests.ProActiveTest)10 TaskInfo (org.ow2.proactive.scheduler.common.task.TaskInfo)9 HashSet (java.util.HashSet)8 SchedulerStateRecoverHelper (org.ow2.proactive.scheduler.core.db.SchedulerStateRecoverHelper)8