Exemplo n.º 1
0
void set_jcr_job_status(JCR *jcr, int JobStatus)
{
   int priority, old_priority;
   int oldJobStatus = jcr->JobStatus;
   priority = get_status_priority(JobStatus);
   old_priority = get_status_priority(oldJobStatus);
   
   Dmsg2(800, "set_jcr_job_status(%s, %c)\n", jcr->Job, JobStatus);

   /* Update wait_time depending on newJobStatus and oldJobStatus */
   update_wait_time(jcr, JobStatus);

   /*
    * For a set of errors, ... keep the current status
    *   so it isn't lost. For all others, set it.
    */
   Dmsg3(300, "jid=%u OnEntry JobStatus=%c set=%c\n", (uint32_t)jcr->JobId,
         jcr->JobStatus, JobStatus);
   if (priority >= old_priority) {
      jcr->JobStatus = JobStatus;     /* replace with new priority */
   }

   if (oldJobStatus != jcr->JobStatus) {
      Dmsg3(200, "jid=%u leave set_old_job_status=%c new_set=%c\n", (uint32_t)jcr->JobId,
         oldJobStatus, JobStatus);
//    generate_plugin_event(jcr, bEventStatusChange, NULL);
   }
}
Exemplo n.º 2
0
void JCR::setJobStatus(int newJobStatus)
{
    JCR *jcr = this;
    int priority, old_priority;
    int oldJobStatus = jcr->JobStatus;
    priority = get_status_priority(newJobStatus);
    old_priority = get_status_priority(oldJobStatus);

    Dmsg2(800, "set_jcr_job_status(%s, %c)\n", Job, newJobStatus);

    /*
     * Update wait_time depending on newJobStatus and oldJobStatus
     */
    update_wait_time(jcr, newJobStatus);

    /*
     * For a set of errors, ... keep the current status
     * so it isn't lost. For all others, set it.
     */
    Dmsg2(800, "OnEntry JobStatus=%c newJobstatus=%c\n", oldJobStatus, newJobStatus);

    /*
     * If status priority is > than proposed new status, change it.
     * If status priority == new priority and both are zero, take the new status.
     * If it is not zero, then we keep the first non-zero "error" that occurred.
     */
    if (priority > old_priority || (
                priority == 0 && old_priority == 0)) {
        Dmsg4(800, "Set new stat. old: %c,%d new: %c,%d\n",
              jcr->JobStatus, old_priority, newJobStatus, priority);
        jcr->JobStatus = newJobStatus;     /* replace with new status */
    }

    if (oldJobStatus != jcr->JobStatus) {
        Dmsg2(800, "leave setJobStatus old=%c new=%c\n", oldJobStatus, newJobStatus);
//    generate_plugin_event(jcr, bEventStatusChange, NULL);
    }
}