Changeset - 8b16602566fc
[Not reviewed]
default
0 1 0
Nathan Brink (binki) - 16 years ago 2009-09-13 16:19:43
ohnobinki@ohnopublishing.net
fixed calls to add_job_to_queue
1 file changed with 2 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/server/distrend.c
Show inline comments
 
@@ -172,49 +172,49 @@ void prepare_distrenjob(struct frameset 
 
  distrenjob->name = name;
 
  distrenjob->submitter = submitter;
 
  distrenjob->email = email;
 
  distrenjob->priority = priority;
 
  distrenjob->frameset = malloc(end_frame - start_frame + 1);
 
  distrenjob->total_frames = (end_frame - start_frame + 1); // sets the total number of frames in animation for status purposes
 

	
 
  /* @TODO: what does this do? frameset array is declared above */
 
  /*
 
  distrenjob->frameset = malloc(sizeof(struct frameset) * numframes);
 
  if(!job->frameset)
 
    fprintf(stderr, "Error allocating memory\n");
 
  */
 

	
 
  /* prepares all the frames by setting that status to "unassigned" */
 
  counter2 = start_frame;
 
  for(counter = 0; counter <= (end_frame- start_frame + 1); counter++){
 
    distrenjob->frameset[counter].num = counter2;
 
    distrenjob->frameset[counter].status = 0;
 

	
 
    counter2++;
 
  }
 

	
 
  /* @TODO: change frame_num_struct_builder to add_blendjob_to_queue */
 
  add_job_to_queue(distrenjob);
 
  add_job_to_queue(head, distrenjob);
 

	
 
  general_info.jobs_in_queue++;
 
}
 

	
 
/** -- OLD -- Queuer: Adds files to the queue
 
int queue(struct distrenjob *distrenjob, int type, char *name, char *submitter, char *email, int priority, int mode, int spp, struct frameset *frameset) {
 
  // Type: 1 = blender, add more types later
 
  // jobnum is the next available job number
 
  if(type == 1){
 
    distrenjob->name = name;
 
    distrenjob->submitter = submitter;
 
    distrenjob->email = email;
 
    distrenjob->priority = priority;
 
    distrenjob->frameset = frameset;
 
  }
 
  else{
 
    // Throw error.
 
    fprintf(stderr,"You tried to queue a job type that isn't supported by this version of DistRen.\nI have no idea how this would happen, but it just did.\n");
 
    return 0; // fail
 
  }
 
jobnum++; // Advance the jobnumber for the next queued job
 
return 0; // OK
 
}*/
 

	
 
@@ -322,49 +322,49 @@ void add_job_to_queue(struct distrenjob 
 
  struct distrenjob *current_job;     // create pointer to current_job (which job is being compared to)
 

	
 
  // iterate through linked list of jobs
 
  for(current_job = head; current_job != NULL; current_job = current_job->next){
 
    if(current_job == NULL){ // if it has reached the end of the list, add job there
 
      current_job = job;
 
      break;
 
    }
 
    else if(job->priority < current_job->priority){ // if job's priority is less than current_job's priority, insert job
 
      prev_job->next = job;                        // keep in mind 1 is the highest priority given to jobs, head has a
 
      job->next = current_job;                     // priority of zero so it will always be before other jobs
 
      break;
 
    }
 

	
 
    prev_job = current_job;
 
  } /* for(current_job) */
 
}
 

	
 
/**
 
   @arg head I may end up changing the head if job == head
 
 */
 
void change_job_priority(struct distrenjob **head, struct distrenjob *job, int new_priority){
 
  distrenjob_remove(head, job);
 
  job->priority = new_priority;
 
  add_job_to_queue(job);
 
  add_job_to_queue(head, job);
 
}
 

	
 
/**
 
  Frame Finder: matches your computer up with a lovely frame to render
 
  TODO: Major issue here, the client needs to know the frame number, AND the job number!
 
  Notice that this function starts by looking at the oldest job first
 

	
 
	TODO: Link this up with the main() function to check if there are frames available or not and provide jobnum/framenum to the client
 

	
 
  @return 0 success, other: error
 
*/
 
int frame_finder(struct distrenjob *head, struct distrenjob **job, struct frameset **frame)
 
{
 
  int your_frame;  // your_frame is an integer value that will be given to the client as the frame number to render
 
  int your_job;	   // @TODO: Fixme: do we need this var? you_job is an integer value that must ALSO be given to the client
 

	
 
  unsigned short int found;
 
  unsigned short int priority;
 

	
 
  struct distrenjob *distrenjob_ptr;
 

	
 
  found = 0;
 
  while(!found)
 
    {
0 comments (0 inline, 0 general)