Changeset - a6a648e19f34
[Not reviewed]
default
0 1 0
NEO - 16 years ago 2009-07-12 18:59:13

added struct general_info and added statements through out the code to update it... but due to errors it doesn't seem to have recognized the struct...
1 file changed with 23 insertions and 7 deletions:
0 comments (0 inline, 0 general)
src/server/distrend.c
Show inline comments
 
@@ -68,13 +68,19 @@ struct distrend_config
 
  "3" - completed by slave and uploaded
 

	
 
 Have a script crawl through each job in the arrays, priority-biased, and assign a frame to each slave.
 
 Then we will need some sort of watchdog to monitor slaves on the main server to check for stales. Maybe not worry about this for now.
 
*/
 

	
 

	
 
struct general_info {
 
	short int jobs_in_queue; //
 
	unsigned short int free_clients;
 
	unsigned short int rendering_clients;//
 
	unsigned short int total_finished_jobs; //
 
	unsigned int total_frames_rendered; //
 
};
 

	
 
// Stores Blender Job Info
 
struct blendjob {
 
  char *name;
 
  char *submitter;
 
  char *email;
 
@@ -107,12 +113,14 @@ struct frameset {
 

	
 
// **** Finish-Setter: Sets a frame to the "completed" status.
 
void finish_frame(int jobnum, int frame){
 
  blendjob[jobnum].frameset[frame].frame_status = 2;
 

	
 
  blendjob[jobnum].frameset[frame].time_to_render = (clock() - blendjob[jobnum].frameset[frame].start_time);
 

	
 
  general_info.total_frames_rendered++;
 
}
 

	
 

	
 
// **** Queuer: Adds files to the queue
 
void queue(int type, char *name, char *submitter, char *email, int priority, int mode, int spp, struct frameset *frameset) {
 
	// Type: 1 = blender, add more types later
 
@@ -136,12 +144,13 @@ jobnum++; // Advance the jobnumber for t
 
void status_report_generator(){
 

	
 
	while(blendjob[(hcfjob+1)].priority == 0)  //If the job after the highest consecutively finished job is finished
 
		hcfjob++;  // adds 1 to the highest consecutively finished job and checks the next one, till the job after the hcfjob is not done
 

	
 
	int num1 = hcfjob+1; // to scan through jobs
 
	unsigned short int workers_working; // used to count the total number of workers working
 

	
 

	
 
	while(num1 <= highest_jobnum){
 
			if(blendjob[num1].priority != 0){ // If the job is not done, scan it
 

	
 
				int num2 = 0;  // to scan through frames
 
@@ -153,15 +162,16 @@ void status_report_generator(){
 
				while(num2 <= blendjob[num1].total_frames){ // scans through frames, based on their status it runs a statement(s)
 
					if(blendjob[num1].frameset[num2].frame_status == 2){ // If the frame is done
 
						finished_frames++;
 
						total_time = total_time + blendjob[num1].frameset[num2].time_to_render;
 
					}
 

	
 
					if(blendjob[num1].frameset[num2].frame_status == 1) // If the frame is assigned
 
					if(blendjob[num1].frameset[num2].frame_status == 1){ // If the frame is assigned
 
						pending_frames++;
 

	
 
						workers_working++;
 
					}
 
					num2++;
 
				}
 

	
 
				// find the percent of completed frames
 
				percent = (finished_frames / blendjob[num1].total_frames) * 100;
 

	
 
@@ -169,37 +179,43 @@ void status_report_generator(){
 
				blendjob[num1].completed_frames = finished_frames;
 
				blendjob[num1].assigned_frames = pending_frames;
 
				blendjob[num1].percent_done = percent;
 
				blendjob[num1].avg_render_time = (total_time / finished_frames);
 
				blendjob[num1].time_remaining = (blendjob[num1].avg_render_time * (blendjob[num1].total_frames - finished_frames));
 

	
 
				if(finished_frames == blendjob[num1].total_frames)  // If all frames are complete, set priority to zero to indicate job is complete
 
					blendjob[num1].priority = 0;
 
				if(finished_frames == blendjob[num1].total_frames){  // If all frames are complete
 
					blendjob[num1].priority = 0;					//set priority to zero to indicate job is complete
 
					general_info.total_finished_jobs++; // add one to the total finished jobs
 

	
 
				}
 
			}
 

	
 
			num1++;
 
			general_info.rendering_clients = workers_working;
 
		}
 

	
 
		general_info.jobs_in_queue = (highest_jobnum - general_info.total_finished_jobs);
 
	}
 

	
 

	
 
// **** 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.
 
void frame_num_struct_builder(int sframe, int eframe) {
 
	int jobnum_new = highest_jobnum + 1;
 
	int total = (sframe - eframe) +1;  // total number of frames
 
	int fcount = sframe; // Used to create all the frames in the structure from sframe to eframe
 
	int x = 0;
 

	
 
	blendjob[jobnum_new].total_frames = total; // sets the total number of frames in animation for status purposes
 

	
 
	while(x < total){
 
	while(x < total){ // This builds the array, with the array starting at zero and the frame_num starting at sframe
 
		blendjob[jobnum_new].frameset[x].frame_num = fcount;
 
		x++;
 
		fcount++;
 
	}
 

	
 
	highest_jobnum++;
 
	highest_jobnum++; // After it has created the job, it adds one to the highest_jobnum interger
 
}
 

	
 

	
 

	
 
// Frame Assigner: matches your computer up with a lovely frame to render
 
int frame_finder(){
0 comments (0 inline, 0 general)