Search in sources :

Example 6 with TaskIdImpl.createTaskId

use of org.ow2.proactive.scheduler.task.TaskIdImpl.createTaskId in project scheduling by ow2-proactive.

the class NoVncSecuredTargetResolverTest method testMagicStringFoundInLiveLogs_MagicStringOnSeveralLines.

@Test
public void testMagicStringFoundInLiveLogs_MagicStringOnSeveralLines() throws Exception {
    String sessionId = SharedSessionStoreTestUtils.createValidSession(schedulerMock);
    SharedSessionStore.getInstance().get(sessionId).getJobsOutputController().addJobOutputAppender("42", createLiveLogs("PA_REMOTE_CONNECTION\nPA_REMOTE_CONNECTION;42;1;vnc;node.grid.com:5900 "));
    when(schedulerMock.getTaskResult("42", "remoteVisuTask")).thenReturn(new TaskResultImpl(TaskIdImpl.createTaskId(new JobIdImpl(42, "job"), "remoteVisuTask", 1), new byte[0], new byte[0], new SimpleTaskLogs("", ""), true));
    InetSocketAddress targetVncHost = new NoVncSecuredTargetResolver().doResolve(sessionId, "42", "remoteVisuTask");
    assertEquals(5900, targetVncHost.getPort());
    assertEquals("node.grid.com", targetVncHost.getHostName());
}
Also used : SimpleTaskLogs(org.ow2.proactive.scheduler.common.task.SimpleTaskLogs) TaskResultImpl(org.ow2.proactive.scheduler.task.TaskResultImpl) InetSocketAddress(java.net.InetSocketAddress) JobIdImpl(org.ow2.proactive.scheduler.job.JobIdImpl) Test(org.junit.Test)

Example 7 with TaskIdImpl.createTaskId

use of org.ow2.proactive.scheduler.task.TaskIdImpl.createTaskId in project scheduling by ow2-proactive.

the class SchedulerClient method getTaskIds.

@Override
public Page<TaskId> getTaskIds(String taskTag, long from, long to, boolean mytasks, boolean running, boolean pending, boolean finished, int offset, int limit) throws NotConnectedException, PermissionException {
    RestPage<TaskStateData> page = null;
    try {
        page = restApi().getTaskStates(sid, from, to, mytasks, running, pending, finished, offset, limit, null);
    } catch (NotConnectedRestException e) {
        throw new NotConnectedException(e);
    } catch (PermissionRestException e) {
        throw new PermissionException(e);
    }
    List<TaskId> lTaskIds = new ArrayList<TaskId>(page.getList().size());
    for (TaskStateData taskStateData : page.getList()) {
        TaskInfoData taskInfo = taskStateData.getTaskInfo();
        TaskIdData taskIdData = taskInfo.getTaskId();
        JobId jobId = new JobIdImpl(taskInfo.getJobId().getId(), taskInfo.getJobId().getReadableName());
        TaskId taskId = TaskIdImpl.createTaskId(jobId, taskIdData.getReadableName(), taskIdData.getId());
        lTaskIds.add(taskId);
    }
    return new Page<TaskId>(lTaskIds, page.getSize());
}
Also used : PermissionException(org.ow2.proactive.scheduler.common.exception.PermissionException) TaskId(org.ow2.proactive.scheduler.common.task.TaskId) TaskStateData(org.ow2.proactive_grid_cloud_portal.scheduler.dto.TaskStateData) NotConnectedException(org.ow2.proactive.scheduler.common.exception.NotConnectedException) TaskInfoData(org.ow2.proactive_grid_cloud_portal.scheduler.dto.TaskInfoData) ArrayList(java.util.ArrayList) NotConnectedRestException(org.ow2.proactive_grid_cloud_portal.scheduler.exception.NotConnectedRestException) Page(org.ow2.proactive.scheduler.common.Page) RestPage(org.ow2.proactive_grid_cloud_portal.scheduler.dto.RestPage) PermissionRestException(org.ow2.proactive_grid_cloud_portal.scheduler.exception.PermissionRestException) TaskIdData(org.ow2.proactive_grid_cloud_portal.scheduler.dto.TaskIdData) JobIdImpl(org.ow2.proactive.scheduler.job.JobIdImpl) JobId(org.ow2.proactive.scheduler.common.job.JobId)

Example 8 with TaskIdImpl.createTaskId

use of org.ow2.proactive.scheduler.task.TaskIdImpl.createTaskId in project scheduling by ow2-proactive.

the class TestTaskIdImpl method testGetIterationIndex.

@Test
public void testGetIterationIndex() throws Exception {
    TaskId taskNoIterationIndex = TaskIdImpl.createTaskId(new JobIdImpl(1L, "job"), "task", 1);
    TaskId taskIterationIndexSmallerThan9 = TaskIdImpl.createTaskId(new JobIdImpl(1L, "job"), "task#1", 1);
    TaskId taskIterationIndexGreaterThan9 = TaskIdImpl.createTaskId(new JobIdImpl(1L, "job"), "task#10", 1);
    TaskId taskReplicatedAndIterated = TaskIdImpl.createTaskId(new JobIdImpl(1L, "job"), "task#10*10", 1);
    assertEquals(0, taskNoIterationIndex.getIterationIndex());
    assertEquals(1, taskIterationIndexSmallerThan9.getIterationIndex());
    assertEquals(10, taskIterationIndexGreaterThan9.getIterationIndex());
    assertEquals(10, taskReplicatedAndIterated.getIterationIndex());
}
Also used : JobIdImpl(org.ow2.proactive.scheduler.job.JobIdImpl) Test(org.junit.Test)

Example 9 with TaskIdImpl.createTaskId

use of org.ow2.proactive.scheduler.task.TaskIdImpl.createTaskId in project scheduling by ow2-proactive.

the class TaskLoggerRelativePathGeneratorTest method testGetRelativePath.

@Test
public void testGetRelativePath() {
    TaskId taskId = TaskIdImpl.createTaskId(new JobIdImpl(1000, "job"), "task", 42L);
    assertThat(new TaskLoggerRelativePathGenerator(taskId).getRelativePath(), is("1000/TaskLogs-1000-42.log"));
}
Also used : TaskId(org.ow2.proactive.scheduler.common.task.TaskId) JobIdImpl(org.ow2.proactive.scheduler.job.JobIdImpl) Test(org.junit.Test)

Example 10 with TaskIdImpl.createTaskId

use of org.ow2.proactive.scheduler.task.TaskIdImpl.createTaskId in project scheduling by ow2-proactive.

the class TaskLoggerRelativePathGeneratorTest method testGetFileName.

@Test
public void testGetFileName() {
    TaskId taskId = TaskIdImpl.createTaskId(new JobIdImpl(1000, "job"), "task", 42L);
    assertThat(new TaskLoggerRelativePathGenerator(taskId).getFileName(), is("TaskLogs-1000-42.log"));
}
Also used : TaskId(org.ow2.proactive.scheduler.common.task.TaskId) JobIdImpl(org.ow2.proactive.scheduler.job.JobIdImpl) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)86 ScriptExecutableContainer (org.ow2.proactive.scheduler.task.containers.ScriptExecutableContainer)52 SimpleScript (org.ow2.proactive.scripting.SimpleScript)52 TaskScript (org.ow2.proactive.scripting.TaskScript)52 JobIdImpl (org.ow2.proactive.scheduler.job.JobIdImpl)49 TaskId (org.ow2.proactive.scheduler.common.task.TaskId)32 TaskContext (org.ow2.proactive.scheduler.task.context.TaskContext)30 NodeDataSpacesURIs (org.ow2.proactive.scheduler.task.context.NodeDataSpacesURIs)29 TaskResultImpl (org.ow2.proactive.scheduler.task.TaskResultImpl)22 JobId (org.ow2.proactive.scheduler.common.job.JobId)19 InProcessTaskExecutor (org.ow2.proactive.scheduler.task.executors.InProcessTaskExecutor)19 TaskResult (org.ow2.proactive.scheduler.common.task.TaskResult)18 InternalTask (org.ow2.proactive.scheduler.task.internal.InternalTask)15 InternalJob (org.ow2.proactive.scheduler.job.InternalJob)14 InternalTaskFlowJob (org.ow2.proactive.scheduler.job.InternalTaskFlowJob)14 InternalScriptTask (org.ow2.proactive.scheduler.task.internal.InternalScriptTask)14 File (java.io.File)11 ArrayList (java.util.ArrayList)11 TaskLauncherInitializer (org.ow2.proactive.scheduler.task.TaskLauncherInitializer)10 ExecuterInformation (org.ow2.proactive.scheduler.task.internal.ExecuterInformation)10