# HG changeset patch # User LordOfWar # Date 2009-09-15 01:54:48 # Node ID 8e1f4a09cd934243b5e6579235802177f6e6f352 # Parent 5a4b1484f2ba4ca05c97d2be33e49e52e10df7df -Deleted status_report_generator -Need to talk about what variables we really need in distrenjob -Updated comments about distrenjob_enqueue diff --git a/src/server/distrend.c b/src/server/distrend.c --- a/src/server/distrend.c +++ b/src/server/distrend.c @@ -222,99 +222,7 @@ return 0; // OK }*/ -/** - Status Report Generator: - -figures out how much of the job is done, where jobnum corresponds to the job number - -removes finished jobs - - @param distrenjobs_head a pointer to a pointer because the head of the distrenjobs linked list may need to be changed by distrenjob_remove -*/ -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 */ - - workers_working = 0; /*@TODO is there another way to trade how many workers are working, this is equal to assigned frames*/ - numjobs = 0; - - for(distrenjob_ptr = *distrenjobs_head; distrenjob_ptr; distrenjob_ptr = distrenjob_ptr->next) - { - 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 */ - - framecounter = 0; - finished_frames = 0; - pending_frames = 0; - percent_frames_finished = 0; - total_time = 0; - - while(framecounter < distrenjob_ptr->total_frames) - /* scans through frames, based on their status it runs a statement(s) */ - { - if(distrenjob_ptr->frameset[framecounter].status == 2) - /* If the frame is done */ - { - finished_frames ++; - } - - if(distrenjob_ptr->frameset[framecounter].status == 1) - /* If the frame is assigned */ - { - pending_frames ++; - workers_working ++; - } - - framecounter ++; - } /* while(framecounter < distrenjob_ptr->total_frames) */ - - // find the percent of completed frames - percent_frames_finished = (finished_frames / distrenjob_ptr->total_frames) * 100; /*< @LordofWar: extraneous parentheses! */ - - /* updates values in the distrenjob struct */ - distrenjob_ptr->completed_frames = finished_frames; - distrenjob_ptr->assigned_frames = pending_frames; - distrenjob_ptr->percent_done = percent_frames_finished; - 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_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) - /* just in case ;-) */ - { - fprintf(stderr, "%s:%d: finished_frames (%lu) > distrenjob_ptr->total_frames (%d)", - __FILE__, __LINE__, - finished_frames, - distrenjob_ptr->total_frames); - abort(); - } - } - - general_info.rendering_clients = workers_working; /*< should this be a +=? */ - - numjobs ++; - } /* while(distrenjob_ptr) */ - - 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. -*/ -/** 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. */ +/* distrenjob_enqueue: This function adds the job to the queue based on its priority */ void distrenjob_enqueue(struct distrenjob *head, struct distrenjob *job) { struct distrenjob *prev_job = head; // create pointer to previous job struct distrenjob *current_job; // create pointer to current_job (which job is being compared to) @@ -394,10 +302,11 @@ int frame_finder(struct distrenjob *head 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 - found = 0; for(your_frame; !found; your_frame++) { if(distrenjob_ptr->frameset[your_frame].status == 0)