Search in sources :

Example 56 with JobIdImpl

use of org.ow2.proactive.scheduler.job.JobIdImpl in project scheduling by ow2-proactive.

the class SchedulerStateRestJobTaskResultTest method testValueOfJobResult.

@Test
public void testValueOfJobResult() throws Throwable {
    TaskResultImpl taskResult = new TaskResultImpl(TaskIdImpl.createTaskId(JobIdImpl.makeJobId("42"), "mytask", 1), ObjectToByteConverter.ObjectStream.convert("hello"), null, null, false);
    JobResultImpl jobResultWithValue = new JobResultImpl();
    JobInfoImpl jobInfo = new JobInfoImpl();
    jobInfo.setJobId(new JobIdImpl(12, "myjob"));
    jobResultWithValue.setJobInfo(jobInfo);
    jobResultWithValue.addTaskResult("mytask", taskResult, false);
    when(mockOfScheduler.getJobResult("42")).thenReturn(jobResultWithValue);
    JobResultData jobResultData = restInterface.jobResult(sessionId, "42");
    TaskResultData taskResultData = jobResultData.getAllResults().get("mytask");
    assertNotNull(taskResultData);
    assertNotNull(taskResultData.getValue());
    assertEquals("hello", taskResultData.getValue());
    Map<String, String> jobResult = restInterface.jobResultValue(sessionId, "42");
    String result = jobResult.get("mytask");
    assertNotNull(result);
    assertEquals("hello", result);
}
Also used : JobResultImpl(org.ow2.proactive.scheduler.job.JobResultImpl) JobResultData(org.ow2.proactive_grid_cloud_portal.scheduler.dto.JobResultData) TaskResultImpl(org.ow2.proactive.scheduler.task.TaskResultImpl) TaskResultData(org.ow2.proactive_grid_cloud_portal.scheduler.dto.TaskResultData) JobIdImpl(org.ow2.proactive.scheduler.job.JobIdImpl) JobInfoImpl(org.ow2.proactive.scheduler.job.JobInfoImpl) Test(org.junit.Test)

Example 57 with JobIdImpl

use of org.ow2.proactive.scheduler.job.JobIdImpl in project scheduling by ow2-proactive.

the class NoVncSecuredTargetResolverTest method testMagicStringFoundInLiveLogs.

@Test
public void testMagicStringFoundInLiveLogs() throws Exception {
    String sessionId = SharedSessionStoreTestUtils.createValidSession(schedulerMock);
    SharedSessionStore.getInstance().get(sessionId).getJobsOutputController().addJobOutputAppender("42", createLiveLogs("[Visualization_task@node2;10:38:06]PA_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 58 with JobIdImpl

use of org.ow2.proactive.scheduler.job.JobIdImpl in project scheduling by ow2-proactive.

the class NoVncSecuredTargetResolverTest method testMagicStringFoundInLogs.

@Test
public void testMagicStringFoundInLogs() throws Exception {
    String sessionId = SharedSessionStoreTestUtils.createValidSession(schedulerMock);
    when(schedulerMock.getTaskResult("42", "remoteVisuTask")).thenReturn(new TaskResultImpl(TaskIdImpl.createTaskId(new JobIdImpl(42, "job"), "remoteVisuTask", 1), new byte[0], new byte[0], new SimpleTaskLogs("PA_REMOTE_CONNECTION;42;1;vnc;node.grid.com:5900", ""), 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 59 with JobIdImpl

use of org.ow2.proactive.scheduler.job.JobIdImpl in project scheduling by ow2-proactive.

the class SchedulerFrontendStateTest method getIdentifiedJobTest.

@Test
public void getIdentifiedJobTest() throws Exception {
    SchedulerJMXHelper mockJMX = mock(SchedulerJMXHelper.class);
    when(mockJMX.getSchedulerRuntimeMBean()).thenReturn(new RuntimeDataMBeanImpl(null));
    SchedulerStateImpl<ClientJobState> schedulerStateImpl = new SchedulerStateImpl<>();
    JobIdImpl jobId = new JobIdImpl(1234L, "job name");
    ClientJobState jobState = mock(ClientJobState.class);
    when(jobState.getId()).thenReturn(jobId);
    schedulerStateImpl.setFinishedJobs(new Vector(Lists.newArrayList(jobState)));
    final SchedulerFrontendState schedulerFrontendState = new SchedulerFrontendState(schedulerStateImpl, mockJMX);
    assertEquals(schedulerFrontendState.getIdentifiedJob(jobId).getJobId(), (jobId));
}
Also used : SchedulerJMXHelper(org.ow2.proactive.scheduler.core.jmx.SchedulerJMXHelper) RuntimeDataMBeanImpl(org.ow2.proactive.scheduler.core.jmx.mbean.RuntimeDataMBeanImpl) ClientJobState(org.ow2.proactive.scheduler.job.ClientJobState) JobIdImpl(org.ow2.proactive.scheduler.job.JobIdImpl) Vector(java.util.Vector) Test(org.junit.Test)

Example 60 with JobIdImpl

use of org.ow2.proactive.scheduler.job.JobIdImpl in project scheduling by ow2-proactive.

the class SchedulerFrontendTest method init.

@Before
public void init() {
    MockitoAnnotations.initMocks(this);
    this.schedulerFrontend = new SchedulerFrontend(frontendState, spacesSupport);
    this.jobId = new JobIdImpl(123L, "readableName");
}
Also used : JobIdImpl(org.ow2.proactive.scheduler.job.JobIdImpl) Before(org.junit.Before)

Aggregations

JobIdImpl (org.ow2.proactive.scheduler.job.JobIdImpl)85 Test (org.junit.Test)70 InternalJob (org.ow2.proactive.scheduler.job.InternalJob)36 JobId (org.ow2.proactive.scheduler.common.job.JobId)34 InternalTaskFlowJob (org.ow2.proactive.scheduler.job.InternalTaskFlowJob)26 TaskId (org.ow2.proactive.scheduler.common.task.TaskId)24 InternalScriptTask (org.ow2.proactive.scheduler.task.internal.InternalScriptTask)24 InternalTask (org.ow2.proactive.scheduler.task.internal.InternalTask)24 ArrayList (java.util.ArrayList)20 ExecuterInformation (org.ow2.proactive.scheduler.task.internal.ExecuterInformation)13 TaskResultImpl (org.ow2.proactive.scheduler.task.TaskResultImpl)12 Matchers.containsString (org.hamcrest.Matchers.containsString)10 Matchers.anyString (org.mockito.Matchers.anyString)10 ScriptExecutableContainer (org.ow2.proactive.scheduler.task.containers.ScriptExecutableContainer)9 TaskContext (org.ow2.proactive.scheduler.task.context.TaskContext)9 TaskInfoImpl (org.ow2.proactive.scheduler.task.TaskInfoImpl)8 SimpleScript (org.ow2.proactive.scripting.SimpleScript)8 TaskScript (org.ow2.proactive.scripting.TaskScript)8 NodeDataSpacesURIs (org.ow2.proactive.scheduler.task.context.NodeDataSpacesURIs)7 InProcessTaskExecutor (org.ow2.proactive.scheduler.task.executors.InProcessTaskExecutor)6