Changeset - 3dde26c84524
[Not reviewed]
default
0 2 0
LordOfWar - 16 years ago 2009-09-18 01:29:03

-renamed blend_frame_watchdog() to frame_watchdog()
-frame_watchdog() now uses the variable watchdog_forgiveness in the distrenjob structure
-watchdog_forgiveness is now is seconds, since it is easier to specify a fraction of an hour with seconds using an integer, rather than trying to use a float or long.
2 files changed with 12 insertions and 10 deletions:
0 comments (0 inline, 0 general)
src/server/distrend.c
Show inline comments
 
@@ -124,7 +124,8 @@ void remotio_send_to_client()
 
}
 

	
 
/** Fill variables after crash / shutdown from XML dumps */
 
int start_data(){
 
int start_data()
 
{
 
  struct stat buffer;
 
  if(stat(SYSCONFDIR "/data.xml", &buffer) == 0){
 

	
 
@@ -143,7 +144,8 @@ int start_data(){
 
}
 

	
 
/** Finish-Setter: Sets a frame to the "completed" status.*/
 
void finish_frame(struct distrenjob *head, struct distrenjob *distrenjob, int frame){
 
void finish_frame(struct distrenjob *head, struct distrenjob *distrenjob, int frame)
 
{
 
  distrenjob->frameset[frame].status = FRAMESETSTATUS_DONE;
 
  distrenjob->total_render_time = distrenjob->total_render_time + (clock() - distrenjob[jobnum].frameset[frame].start_time);
 
  distrenjob->completed_frames++;
 
@@ -158,7 +160,8 @@ void finish_frame(struct distrenjob *hea
 

	
 
/** mortition check to see if a job is actually done by scanning the folder of the job to make sure all frames are present*/
 
// called mortition because it checks the finished "dead" job
 
void mortition(struct distrenjob *head, struct distrenjob *job){
 
void mortition(struct distrenjob *head, struct distrenjob *job)
 
{
 
  short int isJobDone;
 
  int counter;
 
  char *path_and_number;
 
@@ -313,13 +316,12 @@ int find_jobframe(struct distrenjob *hea
 
}
 

	
 
/** Checks for dead, laggy, or stale slaves */
 
void blend_frame_watchdog(struct distrenjob *distrenjob_head)
 
void frame_watchdog(struct distrenjob *distrenjob_head)
 
{
 
  unsigned short int watchdog_forgiveness; /*< seconds to wait on a frame before re-assigning it */
 
  struct distrenjob *distrenjob_ptr;
 
  unsigned int counter;
 

	
 
  watchdog_forgiveness = 1; /*< hours of forgiveness before frame is re-assigned @TODO: Make this more user-configurable (maybe per-job), 3 hours is a LONG time */
 
  /*watchdog_forgiveness = seconds of forgiveness before frame is re-assigned */
 
  distrenjob_ptr = distrenjob_head;
 

	
 
  for(distrenjob_ptr = distrenjob_head; distrenjob_ptr; distrenjob_ptr = distrenjob_ptr->next)
 
@@ -328,9 +330,9 @@ void blend_frame_watchdog(struct distren
 
    for(counter = 0; counter < distrenjob_ptr->total_frames; counter ++)
 
      /* iterate through all frames for this job*/
 
      {
 
        if((distrenjob_ptr->frameset[counter].start_time + (watchdog_forgiveness * 3600)) < clock())
 
        if((distrenjob_ptr->frameset[counter].start_time + distrenjob_ptr->watchdog_forgiveness) < clock())
 
          /*
 
            If frame is not completed within the number of hours specified by watchdog_forgiveness
 
            If frame is not completed within the number of seconds specified by watchdog_forgiveness
 
            Then change the frame status to unassigned
 
           */
 
          distrenjob_ptr->frameset[counter].status = FRAMESETSTATUS_UNASSIGNED;
 
@@ -476,7 +478,7 @@ int main(int argc, char *argv[])
 
      cont = distrend_do(action);
 

	
 
      /* Make the following code more event-driven */
 
      blend_frame_watchdog(&head);
 
      frame_watchdog(&head);
 

	
 

	
 
      struct frameset *frame;
src/server/distrenjob.h
Show inline comments
 
@@ -43,7 +43,7 @@ struct distrenjob {
 
  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 hours till the frame is re-assigned (if client computer crashes etc);
 
  int watchdog_forgiveness; // how many seconds till the frame is re-assigned (if client computer crashes etc);
 
  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)