Example #1
0
  TaskUsage toTaskUsage(JobIdImpl jobId) {
    TaskId taskId = TaskIdImpl.createTaskId(jobId, getTaskName(), getId().getTaskId());

    return new TaskUsage(
        taskId.value(),
        getTaskName(),
        getStartTime(),
        getFinishedTime(),
        getExecutionDuration(),
        getParallelEnvironment() == null ? 1 : getParallelEnvironment().getNodesNumber());
  }
  @Test
  public void testValueOfTaskResult_ExceptionNoMessage() throws Throwable {
    SchedulerRestInterface restInterface = new SchedulerStateRest();

    SchedulerProxyUserInterface mockOfScheduler = mock(SchedulerProxyUserInterface.class);
    String sessionId = SharedSessionStoreTestUtils.createValidSession(mockOfScheduler);

    TaskResultImpl taskResultWithException =
        new TaskResultImpl(
            TaskIdImpl.createTaskId(JobIdImpl.makeJobId("42"), "mytask", 1),
            null,
            new byte[0],
            null);
    when(mockOfScheduler.getTaskResult("42", "mytask")).thenReturn(taskResultWithException);

    String exceptionStackTrace =
        (String) restInterface.valueOftaskresult(sessionId, "42", "mytask");

    assertNotNull(exceptionStackTrace);
  }
  @Test
  public void testValueOfJobResult_ExceptionNoMessage() throws Throwable {
    SchedulerRestInterface restInterface = new SchedulerStateRest();

    SchedulerProxyUserInterface mockOfScheduler = mock(SchedulerProxyUserInterface.class);
    String sessionId = SharedSessionStoreTestUtils.createValidSession(mockOfScheduler);

    TaskResultImpl taskResultWithException =
        new TaskResultImpl(
            TaskIdImpl.createTaskId(JobIdImpl.makeJobId("42"), "mytask", 1),
            null,
            new byte[0],
            null);
    JobResultImpl jobResultWithException = new JobResultImpl();
    jobResultWithException.addTaskResult("mytask", taskResultWithException, false);
    when(mockOfScheduler.getJobResult("42")).thenReturn(jobResultWithException);

    Map<String, String> jobResult = restInterface.jobResultValue(sessionId, "42");
    String exceptionStackTrace = jobResult.get("mytask");

    assertNotNull(exceptionStackTrace);
  }
Example #4
0
 TaskId createTaskId(InternalJob internalJob) {
   return TaskIdImpl.createTaskId(internalJob.getId(), getTaskName(), getId().getTaskId());
 }