Uploaded image for project: 'Opencast'
  1. MH-11306

Change job dispatcher sort order to: restart jobs, non-wf jobs, creation date

    Details

    • Type: Task
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed and reviewed
    • Affects versions: 1.7.0, 2.1.1
    • Fix versions: 2.2.0
    • Components: Backend Software

      Description

      Currently, the order in which the jobs are dispatched doesn't match the comments in the code. This is very confusing for someone looking at the code and trying to debug a problem and also the comments make more sense than what the method is actually doing.
      So the new order will be: restarting jobs are dispatched first, then non-workflow jobs and, if both match, jobs that were created before are dispatched first.
      The dispatcher comparison will be something like:

      private static final class DispatchableComparator implements Comparator<Job> {

      @Override
      public int compare(Job jobA, Job jobB) {

      // Jobs that are in "restart" mode should be handled first
      if (Job.Status.RESTART.equals(jobA.getStatus()) && !Job.Status.RESTART.equals(jobB.getStatus()))

      { return -1; } else if (Job.Status.RESTART.equals(jobB.getStatus()) && !Job.Status.RESTART.equals(jobA.getStatus())) { return 1; }

      // Regular jobs should be processed prior to workflow and workflow operation jobs
      if (TYPE_WORKFLOW.equals(jobA.getJobType()) && !TYPE_WORKFLOW.equals(jobB.getJobType())) { return 1; } else if (TYPE_WORKFLOW.equals(jobB.getJobType()) && !TYPE_WORKFLOW.equals(jobA.getJobType())) { return -1; }

      // Use date_created
      if (jobA.getDateCreated() != null && jobB.getDateCreated() != null)

      { if (jobA.getDateCreated().getTime() < jobB.getDateCreated().getTime()) return -1; else if (jobA.getDateCreated().getTime() > jobB.getDateCreated().getTime()) return 1; }

      // Undecided
      return 0;
      }

      }

        TestRail: Results

          Attachments

            Activity

              People

              • Assignee:
                rsantos Rute Santos
                Reporter:
                rsantos Rute Santos
              • Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  TestRail: Cases