Changeset - 13533b1094bd
[Not reviewed]
default
0 2 0
LordOfWar - 16 years ago 2009-09-14 02:22:57

-removed TODO saying that we needed to add \"int type\" to framestruct, added comments about \"type\"
--In status_report_generator()--
-now starts scanning on jobs after the head job
-changed while statement to a for loop, much more reliable
-removed the setting of priority of the job to zero to say its complete, is useless since it is removed from the queue in the next statement.
-if the job has not been started, it is not scanned
-since queue is now a linked list, the total number of jobs simply equals the amount of times the for loop iterates which is counted by numjobs
2 files changed with 7 insertions and 10 deletions:
0 comments (0 inline, 0 general)
src/server/distrend.c
Show inline comments
 
@@ -166,13 +166,13 @@ void prepare_distrenjob(struct frameset 
 
{
 
  int counter2;
 
  int counter;
 

	
 
  struct distrenjob *distrenjob;
 

	
 
  distrenjob->type = 1; /*@TODO: add type to blendjob struct*/
 
  distrenjob->type = 1;
 
  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
 
@@ -230,20 +230,19 @@ return 0; // OK
 
void status_report_generator(struct distrenjob **distrenjobs_head)
 
{
 
  struct distrenjob *distrenjob_ptr;
 
  unsigned short workers_working; /*< used to count the total number of workers working */
 
  unsigned int numjobs; /*< used to track number of jobs */
 

	
 
  distrenjob_ptr = *distrenjobs_head;
 
  workers_working = 0;
 
  workers_working = 0; /*@TODO is there another way to trade how many workers are working, this is equal to assigned frames*/
 
  numjobs = 0;
 

	
 
  while(distrenjob_ptr)
 
  for(distrenjob_ptr = *distrenjobs_head; distrenjob_ptr; distrenjob_ptr = distrenjob_ptr->next)
 
    {
 
      if(distrenjob_ptr->priority != 0)
 
	/* If the job is not done, scan it */
 
      if(distrenjob_ptr->frameset[0].status == 0 && distrenjob_ptr->frameset[1].status == 0)
 
	/* If the job has been started, scan it */
 
	{
 
	  unsigned int framecounter;  /*< to scan through frames */
 
	  unsigned long finished_frames; /*< variable that counts the completed frames */
 
	  unsigned int pending_frames; /*< variable that counts the assigned frames */
 
	  float percent_frames_finished;  /*< variable that stores the percent done of the distrenjob */
 
	  unsigned int total_time;  /*< total time taken to render all the completed frames for a job */
 
@@ -284,13 +283,12 @@ void status_report_generator(struct dist
 
	  distrenjob_ptr->avg_render_time = (total_time / finished_frames); /*< extraneous parentheses! */
 
	  distrenjob_ptr->time_remaining = (distrenjob_ptr->avg_render_time * (distrenjob_ptr->total_frames - finished_frames)); /*< extraneous parentheses! */
 

	
 
	  if(finished_frames == distrenjob_ptr->total_frames)
 
	    /* If all frames are complete */
 
	    {
 
	      distrenjob_ptr->priority = 0; /*< set priority to zero to indicate job is complete */
 
	      distrenjob_remove(distrenjobs_head, distrenjob_ptr); /*< remove this job from the linkedlist */
 
	      distrenjob_free(distrenjob_ptr);
 
	      general_info.total_finished_jobs++; /*< add one to the total finished jobs */
 

	
 
	    }
 
	  else if (finished_frames > distrenjob_ptr->total_frames)
 
@@ -303,17 +301,16 @@ void status_report_generator(struct dist
 
	      abort();
 
	    }
 
	}
 

	
 
      general_info.rendering_clients = workers_working; /*< should this be a +=? */
 

	
 
      distrenjob_ptr = distrenjob_ptr->next; /*< This is the essence of linked lists and iterating through them */
 
      numjobs ++;
 
    } /* while(distrenjob_ptr) */
 

	
 
  general_info.jobs_in_queue = (highest_jobnum - general_info.total_finished_jobs); /*< extraneous parentheses! */
 
  general_info.jobs_in_queue = numjobs;
 
}
 

	
 

	
 
/**
 
   Structure Builder: This function creates frame array based on the total number of frames to be rendered, which will then be parsed by function frame_farmer.
 
*/
src/server/distrenjob.h
Show inline comments
 
@@ -31,13 +31,13 @@ typedef unsigned int jobnum_t;
 

	
 
/**
 
   Stores Blender Job Info
 
*/
 
struct distrenjob {
 
  struct distrenjob *next; /*< next will be NULL unless if there is another distrenjob */
 
  int type;
 
  int type; // 1:Blender, 2:something else
 
  char *name;
 
  char *submitter;
 
  char *email; /*< This should be looked up based on the value of submitter, not stored in this struct */
 
  jobnum_t jobnum;
 
  int priority;  // 1 is lowest, 10 is highest, 0 means the job is done
 
  float percent_done;
0 comments (0 inline, 0 general)