Changeset - 0f74d7c8d753
[Not reviewed]
default
0 2 0
LordOfWar - 16 years ago 2009-09-15 23:02:23

updated and simplified frame_finder()

removed isJobDone from distrenjob structure... since all jobs will be using
2 files changed with 10 insertions and 17 deletions:
0 comments (0 inline, 0 general)
src/server/distrend.c
Show inline comments
 
@@ -284,40 +284,34 @@ void change_job_priority(struct distrenj
 
/*@TODO: change frame_finder to job_finder */
 
int frame_finder(struct distrenjob *head, struct distrenjob **job, struct frameset **frame)
 
{
 
  int your_frame = 0;  // your_frame is an integer value that will be given to the client as the frame number to render
 
  short int your_job_type = 0;
 
  int your_frame;  // your_frame is an integer value that will be given to the client as the frame number to render
 
  short int your_job_type;
 
  unsigned short int found;
 

	
 
  struct distrenjob *distrenjob_ptr;
 

	
 
  your_frame = 0;
 
  your_job_type = 0;
 
  found = 0;
 

	
 
  while(!found)
 
  {
 
    /* iterate through jobs from first to last */
 
    for(distrenjob_ptr = head->next; !found && !distrenjob_ptr; distrenjob_ptr = distrenjob_ptr->next)
 
      {
 
        if(distrenjob_ptr->is_job_done)
 
          distrenjob_ptr->type = your_job_type;
 
      }
 

	
 
    found = 0;
 
    // check the job type to see if the job is avaliable to be worked on
 
    switch(your_job_type)
 
    {
 
      case 1: // blender
 
        for(your_frame; !found; your_frame++)
 
      // while frame hasn't been found, and your_frame is less than the length of the frameset array
 
      for(your_frame; !found && your_frame < distrenjob_ptr->total_frames; your_frame++)
 
          {
 
            if(distrenjob_ptr->frameset[your_frame].status == 0)
 
              {
 
                found = 1;
 
              your_job_type = distrenjob_ptr->type;
 
                distrenjob_ptr->frameset[your_frame].status = 1;
 
                distrenjob_ptr->frameset[your_frame].start_time = clock();
 
                break;
 
              }
 
          }
 
    }
 
  } // end of while statement... job must be found or linked list must be ended to get out of here
 

	
 

	
 
// end of while statement... job must be found or linked list must be ended to get out of here
 
      if(!found)
 
        {
 
          fprintf(stderr, "No more jobs to render\n");
src/server/distrenjob.h
Show inline comments
 
@@ -35,7 +35,6 @@ typedef unsigned int jobnum_t;
 
struct distrenjob {
 
  struct distrenjob *next; /*< next will be NULL unless if there is another distrenjob */
 
  short int type; // 1:Blender, 2:something else
 
  short int is_job_done; // so job finder can tell if the job is done no matter what type of job it is
 
  char *name;
 
  char *submitter;
 
  char *email; /*< This should be looked up based on the value of submitter, not stored in this struct */
0 comments (0 inline, 0 general)