Пример #1
0
  @Test
  public void testTaskLogServerByTag() throws Exception {
    HttpResponse response = sendRequest("jobs/" + jobId + "/tasks/tag/LOOP-T2-1/log/server");
    String responseContent = getContent(response);

    for (TaskState state : scheduler.getJobState(jobId).getTasksByTag("LOOP-T2-1")) {
      assertTrue(responseContent.contains("Task " + state.getId() + " logs"));
    }
  }
 @Override
 public boolean isTaskFinished(String jobId, String taskName)
     throws UnknownJobException, NotConnectedException, PermissionException, UnknownTaskException {
   boolean finished = false;
   try {
     TaskStateData taskStateData = restApi().jobtasks(sid, jobId, taskName);
     TaskState taskState = taskState(taskStateData);
     finished = !taskState.getStatus().isTaskAlive();
   } catch (Exception e) {
     throwUJEOrNCEOrPEOrUTE(e);
   }
   return finished;
 }
Пример #3
0
 @Override
 public int compare(TaskState task1, TaskState task2) {
   return Long.compare(task1.getFinishedTime(), task2.getFinishedTime());
 }
Пример #4
0
 /** @see java.lang.Comparable#compareTo(java.lang.Object) */
 public int compareTo(TaskState task) {
   switch (currentSort) {
     case SORT_BY_DESCRIPTION:
       return (currentOrder == ASC_ORDER)
           ? (description.compareTo(task.description))
           : (task.description.compareTo(description));
     case SORT_BY_NAME:
       return (currentOrder == ASC_ORDER)
           ? (name.compareTo(task.name))
           : (task.name.compareTo(name));
     case SORT_BY_STATUS:
       return (currentOrder == ASC_ORDER)
           ? (getStatus().compareTo(task.getStatus()))
           : (task.getStatus().compareTo(getStatus()));
     case SORT_BY_STARTED_TIME:
       return (currentOrder == ASC_ORDER)
           ? ((int) (getStartTime() - task.getStartTime()))
           : ((int) (task.getStartTime() - getStartTime()));
     case SORT_BY_FINISHED_TIME:
       return (currentOrder == ASC_ORDER)
           ? ((int) (getFinishedTime() - task.getFinishedTime()))
           : ((int) (task.getFinishedTime() - getFinishedTime()));
     case SORT_BY_EXECUTIONLEFT:
       return (currentOrder == ASC_ORDER)
           ? (Integer.valueOf(getNumberOfExecutionLeft())
               .compareTo(Integer.valueOf(task.getNumberOfExecutionLeft())))
           : (Integer.valueOf(task.getNumberOfExecutionLeft())
               .compareTo(Integer.valueOf(getNumberOfExecutionLeft())));
     case SORT_BY_EXECUTIONONFAILURELEFT:
       return (currentOrder == ASC_ORDER)
           ? (Integer.valueOf(getNumberOfExecutionOnFailureLeft())
               .compareTo(Integer.valueOf(task.getNumberOfExecutionOnFailureLeft())))
           : (Integer.valueOf(task.getNumberOfExecutionOnFailureLeft())
               .compareTo(Integer.valueOf(getNumberOfExecutionOnFailureLeft())));
     case SORT_BY_HOST_NAME:
       return (currentOrder == ASC_ORDER)
           ? (getExecutionHostName().compareTo(task.getExecutionHostName()))
           : (task.getExecutionHostName().compareTo(getExecutionHostName()));
     case SORT_BY_EXEC_DURATION:
       return (currentOrder == ASC_ORDER)
           ? (int) (getExecutionDuration() - task.getExecutionDuration())
           : (int) (task.getExecutionDuration() - getExecutionDuration());
     default:
       return (currentOrder == ASC_ORDER)
           ? (getId().compareTo(task.getId()))
           : (task.getId().compareTo(getId()));
   }
 }