Changeset - 6148c5ef5f33
[Not reviewed]
default
0 1 0
LordOfWar - 16 years ago 2009-10-10 00:41:59

put updateGeneralInfo() in 3 locations covering all spots where jobs and completed_frames are added and removed, and patched up an error or 2.
1 file changed with 8 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/server/distrend.c
Show inline comments
 
@@ -74,13 +74,13 @@ struct distrenjob *distrenjob_get(struct
 
void distrenjob_enqueue(struct distrenjob *head, struct distrenjob *job);
 
void mortition(struct distrenjob *head, struct distrenjob *job);
 
int makeJobDataXML(struct distrenjob *job);
 
int updateJobListXML(struct distrenjob *head);
 
int createQueueFromXML(struct distrenjob *head);
 
int reCreateQueueFromXML(struct distrenjob *head, xmlDocPtr doc, xmlNodePtr current);
 

	
 
void updateGeneralInfo();
 

	
 
/* Global Vars, eliminate these */
 
jobnum_t jobnum = 0; // The next job number to create in the queue
 
int hcfjob; // Highest consecutively finished job
 
int highest_jobnum; // The job number of the most recently created job, this is used when creating new jobs
 

	
 
@@ -166,12 +166,14 @@ void finish_frame(struct distrenjob *hea
 
  general_info.total_frames_rendered++; // Increase total frames var for stats
 

	
 
  if(distrenjob->completed_frames == distrenjob->total_frames)
 
    {
 
      mortition(head, distrenjob);
 
    }
 

	
 
  updateGeneralInfo();
 
}
 

	
 
/** "mortition" check to see if a job is actually done by scanning the folder of the job to make sure all frames are present*/
 
void mortition(struct distrenjob *head, struct distrenjob *job)
 
{
 
  short int isJobDone;
 
@@ -184,12 +186,13 @@ void mortition(struct distrenjob *head, 
 
    {
 
      _distren_asprintf(&path_and_number, "stor/job%d/out/%d.%s", job->jobnum, job->frameset[counter].num, job->output_format);
 
      if(stat(path_and_number, &buffer) == -1)
 
        {
 
          job->frameset[counter].status = FRAMESETSTATUS_UNASSIGNED;
 
          job->completed_frames--;
 
          general_info.total_frames_rendered--;
 
          isJobDone = 0; // if a missing frame is found, set isJobDone to false
 
        }
 
    }
 

	
 
  if(isJobDone) // if all frames were accounted for
 
    {
 
@@ -198,12 +201,14 @@ void mortition(struct distrenjob *head, 
 
      general_info.jobs_in_queue--;
 
      updateJobListXML(head);
 
    }
 
  else{
 
    job->prev_frame_index = 0; // if the job isn't done, have frame_finder() start from the first frame, allowing it to see the frames that are now unassigned
 
  }
 

	
 
  updateGeneralInfo();
 
}
 

	
 
/** scans the frames of a job to initialize a job after server */
 
/* returns 1 if the job is completely done and there are no missing frames */
 
/* returns 0 if a missing frame is found */
 
int restoreJobState(struct distrenjob *job)
 
@@ -256,15 +261,16 @@ void prepare_distrenjob(struct distrenjo
 
    counter2++;
 
  }
 

	
 
  /* add job to queue */
 
  makeJobDataXML(distrenjob);
 
  distrenjob_enqueue(head, distrenjob);
 
  updateJobListXML(head);
 

	
 
  general_info.jobs_in_queue++;
 
  updateJobListXML(head);
 
  updateGeneralInfo();
 
}
 

	
 

	
 
/** distrenjob_enqueue: This function adds the job to the queue based on its priority */
 
void distrenjob_enqueue(struct distrenjob *head, struct distrenjob *job) {
 
  struct distrenjob *prev_job = head; // create pointer to previous job
0 comments (0 inline, 0 general)