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());
}
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());
}
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());
}
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"));
}
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"));
}
Aggregations