ReservationScheduling

From GridWiki
Jump to: navigation, search

Assignment Scheduling and Reservation Scheduling

With each job the scheduling algorithm tries at first to find an immediate assignment (=assignment scheduling) and then makes a reservation (=reservation scheduling) if necessary. Luckily assignment scheduling and reservation scheduling do not differ that much, so it was possible to use most of the code portions with both scheduling steps. The branching between assignment scheduling and reservation scheduling occurs in select_assign_debit() for sequential jobs


      /*------------------------------------------------------------------
       * SELECT POSSIBLE QUEUE(S) FOR THIS SEQUENTIAL JOB
       *------------------------------------------------------------------*/

      a.slots = 1;

      if (is_start) {

         DPRINTF(("### looking for immediate sequential assignment for job "
                  sge_U32CFormat"."sge_U32CFormat" duration "sge_U32CFormat"\n", a.job_id,
                  a.ja_task_id, a.duration));

         a.start = DISPATCH_TIME_NOW;
         a.is_reservation = false;
         if (is_reserve) {
            is_computed_reservation = true;
            if (*queue_list == NULL) {
               *queue_list  = lCreateList("temp queue", lGetListDescr(*dis_queue_list));
               a.queue_list = *queue_list;
            }
            lAppendList(*queue_list, *dis_queue_list);
         }
         result = sge_sequential_assignment(&a);

         DPRINTF(("sge_sequential_assignment(immediate) returned %d\n", result));
      }

      /* try to reserve for jobs that can be dispatched with the current configuration */
      if (result == DISPATCH_NOT_AT_TIME) {
         if (is_reserve) {
            DPRINTF(("### looking for sequential reservation for job "
               sge_U32CFormat"."sge_U32CFormat" duration "sge_U32CFormat"\n",
                  a.job_id, a.ja_task_id, a.duration));
            a.start = DISPATCH_TIME_QUEUE_END;
            a.is_reservation = true;

            result = sge_sequential_assignment(&a);
            if (result == DISPATCH_OK) {
               result = DISPATCH_NOT_AT_TIME; /* this job got a reservation */
            }
         }
         else {
            result = DISPATCH_NEVER_CAT;
         }
      }


and parallel jobs

      /*------------------------------------------------------------------
       * SELECT POSSIBLE QUEUE(S) FOR THIS PE JOB
       *------------------------------------------------------------------*/

      if (is_start) {

         DPRINTF(("### looking for immediate parallel assignment for job "
                  sge_U32CFormat"."sge_U32CFormat" requesting pe \"%s\" duration "sge_U32CFormat"\n",
                  a.job_id, a.ja_task_id, pe_name, a.duration));

         a.start = DISPATCH_TIME_NOW;
         a.is_reservation = false;
         if (is_reserve) {
            if (*queue_list == NULL) {
               *queue_list = lCreateList("temp queue", lGetListDescr(*dis_queue_list));
               a.queue_list       = *queue_list;
            }
            is_computed_reservation = true;
            lAppendList(*queue_list, *dis_queue_list);
         }

         result = sge_select_parallel_environment(&a, pe_list);
      }

      if (result == DISPATCH_NOT_AT_TIME) {
         if (is_reserve) {
            DPRINTF(("### looking for parallel reservation for job "
               sge_U32CFormat"."sge_U32CFormat" requesting pe \"%s\" duration "sge_U32CFormat"\n",
                  a.job_id, a.ja_task_id, pe_name, a.duration));
            is_computed_reservation = true;
            a.start = DISPATCH_TIME_QUEUE_END;
            a.is_reservation = true;

            result = sge_select_parallel_environment(&a, pe_list);

            if (result == DISPATCH_OK) {
               result = DISPATCH_NOT_AT_TIME; /* this job got a reservation */
            }
         }
         else {
            result = DISPATCH_NEVER_CAT;
         }
      }

due to "a.is_reservation" being set accordingly any function below select_assign_debit() can easily differ between assignment scheduling and reservation scheduling. See custom essays