Changeset - de2583236e8e
[Not reviewed]
default
0 1 0
ethanzonca - 16 years ago 2009-09-05 20:30:04

Other minor changes to server code
1 file changed with 13 insertions and 5 deletions:
0 comments (0 inline, 0 general)
src/server/distrend.c
Show inline comments
 
@@ -79,12 +79,17 @@ jobnum_t jobnum = 0; // The next job num
 
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
 

	
 

	
 
/* ********************** Functions ************************* */
 

	
 
/** Dumps all data in RAM to an xml file (such as current jobs, etc) which is parsed by start_data. Remember to invoke this before shutting down! */
 
int xml_dump()
 
{
 
  return 0;
 
}
 
/**
 
   Performs command stored in a client's request.
 
*/
 
int distrend_do()
 
{
 
  return 0;
 
@@ -126,13 +131,15 @@ void remotio_send_to_client()
 
}
 

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

	
 
    // @TODO: retrieve total_finished_jobs and total_finished_frames from xml file
 

	
 
    fprintf(stderr,"Parsing XML files and restoring previous state...\n");
 
    return 1;
 
  }
 
  else{
 
    general_info.total_finished_jobs = 0;
 
    general_info.total_frames_rendered = 0;
 
@@ -268,13 +275,13 @@ void status_report_generator(struct dist
 
void frame_num_struct_builder(struct distrenjob *job, unsigned int startframe, unsigned int numframes) {
 
  int jobnum_new = highest_jobnum + 1; /* global vars will someday leave us  */
 
  unsigned int counter;
 

	
 
  job->frameset = malloc(sizeof(struct frameset) * numframes);
 
  if(!job->frameset)
 
    fprintf(stderr, "error allocating memory");
 
    fprintf(stderr, "Error allocating memory\n");
 

	
 
  job->total_frames = numframes; // sets the total number of frames in animation for status purposes
 
  job->jobnum = jobnum_new;
 

	
 
  for(counter = 0; counter < numframes; counter ++)
 
    /* This builds the array, with the array starting at zero and the frameset.num starting at sframe */
 
@@ -319,13 +326,13 @@ int frame_finder(struct distrenjob *head
 
            distrenjob_ptr = distrenjob_ptr->next)
 
          if(distrenjob_ptr->priority == priority)
 
	    found = 1;
 

	
 
      if(!found)
 
        {
 
          fprintf(stderr, "out of jobs to render\n");
 
          fprintf(stderr, "No more jobs to render\n");
 
          return 1;
 
        }
 

	
 
      found = 0;
 
      for(your_frame = 0;
 
        your_frame < distrenjob_ptr->total_frames;
 
@@ -340,16 +347,17 @@ int frame_finder(struct distrenjob *head
 

	
 
	  /* If that job had no open frames for some reason, run the status report generator so that */
 
          status_report_generator(&head);
 

	
 
          /* should the job be removed now? */
 
          fprintf(stderr, "Job %d is finished, this is probably the place to call the job-removal function\n", distrenjob_ptr->jobnum);
 
          /* @TODO: At this point, all slaves should be instructed to delete the source data for this job. */
 
        }
 
    }
 

	
 
  /* sets the value of the frame to 1, which means its taken !!!!!! MISSSING APOSTROPHE!!!!!!! */
 
  /* Sets the value of the frame to 1, which means it is taken */
 
  distrenjob_ptr->frameset[your_frame].status++;
 

	
 
  distrenjob_ptr->frameset[your_frame].start_time = clock();
 

	
 
  *job = distrenjob_ptr;
 
  *frame =  &distrenjob_ptr->frameset[your_frame];
 
@@ -361,13 +369,13 @@ int frame_finder(struct distrenjob *head
 
void blend_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 = 3; /*< 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 = 1; /*< hours of forgiveness before frame is re-assigned @TODO: Make this more user-configurable (maybe per-job), 3 hours is a LONG time */
 
  distrenjob_ptr = distrenjob_head;
 

	
 
  for(distrenjob_ptr = distrenjob_head; distrenjob_ptr; distrenjob_ptr = distrenjob_ptr->next)
 
    /* iterate through jobs */
 

	
 
    for(counter = 0; counter < distrenjob_ptr->total_frames; counter ++)
0 comments (0 inline, 0 general)