Changeset - 0072103d825f
[Not reviewed]
default
0 2 0
LordOfWar - 16 years ago 2009-09-22 23:08:20

-added prev_frame_index to distrenjob queue
-mortition() now changes prev_frame_index to zero if the job is not completely done
-find_jobframe() now starts in the frameset array at prev_frame_index
-efficiency for finding every frame in the job goes from ((x^2)/2 where x = total_frames) to (3 * total_frames);
2 files changed with 6 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/server/distrend.c
Show inline comments
 
@@ -178,18 +178,21 @@ void mortition(struct distrenjob *head, 
 
          job->frameset[counter].status = FRAMESETSTATUS_UNASSIGNED;
 
          job->completed_frames--;
 
          isJobDone = 0; // if a missing frame is found, set isJobDone to false
 
        }
 
    }
 

	
 
  if(isJobDone)
 
  if(isJobDone) // if all frames were accounted for
 
    {
 
      distrenjob_remove(head, job);
 
      distrenjob_free(&job);
 
      general_info.jobs_in_queue--;
 
    }
 
  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
 
  }
 
}
 

	
 
/**
 
   creates a structure from starting data, then calls another function to actually add that struct to the queue
 
*/
 
void prepare_distrenjob(struct distrenjob *head, int type, char *name, char *submitter, char *email, int priority, int start_frame, int end_frame)
 
@@ -295,13 +298,13 @@ int find_jobframe(struct distrenjob *hea
 
  struct distrenjob *distrenjob_ptr;
 

	
 
  your_job_type = 0;
 
  found = 0;
 
  /* iterate through jobs from first to last */
 
  for(distrenjob_ptr = head->next; (!found && !distrenjob_ptr) && !distrenjob_ptr->hibernate; distrenjob_ptr = distrenjob_ptr->next)
 
    for(frame_counter = 0; !found && frame_counter < distrenjob_ptr->total_frames; frame_counter ++)
 
    for(frame_counter = distrenjob_ptr->prev_frame_index; !found && frame_counter < distrenjob_ptr->total_frames; frame_counter ++)
 
      if(distrenjob_ptr->frameset[frame_counter].status == FRAMESETSTATUS_UNASSIGNED)
 
	{
 
	  found = 1;
 
	  your_job_type = distrenjob_ptr->type;
 
	  distrenjob_ptr->frameset[frame_counter].status = FRAMESETSTATUS_ASSIGNED;
 
	  distrenjob_ptr->frameset[frame_counter].start_time = clock();
src/server/distrenjob.h
Show inline comments
 
@@ -42,12 +42,13 @@ struct distrenjob {
 
  int priority;  // 1 is lowest, 10 is highest, 0 means the job is done
 
  int completed_frames; // number of completed frames for stats/etc
 
  int assigned_frames; // number of assigned frames (that are not yet completed) for stats/etc
 
  int total_frames; // how many frames are in the animation for stats/etc (unassigned frames)
 
  int watchdog_forgiveness; // how many seconds till the frame is re-assigned (if client computer crashes etc);
 
  short int hibernate;
 
  int prev_frame_index; // the position in the array of the last frame that was assigned
 
  time_t total_render_time; // total seconds of time spent on all the completed frames
 
  char *output_format; /*< currently is the file extention of the request output format. @todo make this mime-type based/not a string */
 
  struct frameset *frameset;
 
};
 

	
 

	
0 comments (0 inline, 0 general)