Changeset - 558bdb8753cd
[Not reviewed]
default
0 1 0
lordofwar - 16 years ago 2009-07-02 00:06:34

Got rid of a small amount of crap I made earlier.

Added a function to the slave portion that should tell the server that it completed its frame. Ohnobinki should check if it is correct ;) .
1 file changed with 5 insertions and 11 deletions:
0 comments (0 inline, 0 general)
src/server/distrend.c
Show inline comments
 
@@ -167,148 +167,142 @@ void loginuser(char *username, int secre
 
  size_t readlen;
 
  fprintf(stderr, "Opening stream:\n", execio_open(&testrem, "ssh", execargv));
 
  buf[9] = '\0'; // null-terminating the array...
 
  while(!execio_read(testrem, buf, 9, &readlen)) // What's with the readlen stuff?
 
    {
 
      if(readlen > 9) {
 
	fprintf(stderr, "!!!! Something is terribly wrong!\n");
 
      }
 
      if(buf == 0) {
 
	fprintf(stderr, "**** Operation successful, or so we hope. We got no output. Just kidding. You will never see this. Something else should catch this though!");
 
      }
 
    buf[readlen] = '\0'; // Null-terminating the end of it again based on how large the data is?
 
    fprintf(stderr, "read \"%s\"\n", buf);
 
    }
 
  execio_close(testrem);
 
}
 

	
 

	
 

	
 

	
 

	
 

	
 

	
 

	
 

	
 
/*
 
 frame[frame] Assignments:
 
  "0" - cancelled
 
  "1" - unassigned
 
  "2" - assigned to slave
 
  "3" - completed by slave and uploaded
 
 Have a script crawl through each job in the arrays, ordered by priority?, and assign a certain number of frames to each slave.
 
 Then we will need some sort of watchdog to monitor slaves on the main server to check for stales.
 
*/
 

	
 

	
 
/* 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_array_builder(int sframe, int eframe) {
 
	int total = eframe + 1;
 
	int x = sframe;
 
	blendjob[jobnum].frameset[total];
 

	
 
	while(x <= eframe){
 
		blendjob[jobnum].frameset[x]=0;
 
		x++;
 
	}
 
}
 

	
 
// matches your computer up with a lovely frame to render
 
int frame_finder(){
 
	int your_frame = 0;  // your_frame is an interger value that will be given to the client as the frame number to render
 

	
 
	while(your_frame < eframe){ // this finds a frame with the value of zero, which is a frame that is ready to be rendered
 
		if (blendjob[jobnum].frameset[your_frame] = 0)
 
			break;
 

	
 
		your_frame++;
 
	}
 
blendjob[jobnum].frameset[your_frame]++; // sets the value of the frame to 2, which means its taken
 

	
 
return your_frame; // your_frame is returned as the frame to be rendered
 
}
 

	
 
// This function makes the value of the frame 2, which means its completed.
 
void the_finisher(int frame){
 
	blendjob[jobnum].frameset[frame]++;
 
}
 

	
 
// Queuer: this function should add files to the queue
 
// Type: 0 = blender, 1 = luxrender
 
// jobnum is the current job number
 

	
 
void queue(int type, char *name, char *submitter, char *email, int priority, int mode, int spp, *frameset) {
 
  if(type == 1){
 
    blendjob[jobnum].name = name;
 
    blendjob[jobnum].submitter = submitter;
 
    blendjob[jobnum].email = email;
 
    blendjob[jobnum].priority = priority;
 
    blendjob[jobnum].frameset =  frameset;
 
  }
 
  if(type == 2){
 
    luxjob[jobnum].name = name;
 
    luxjob[jobnum].submitter = submitter;
 
    luxjob[jobnum].email = email;
 
    luxjob[jobnum].priority = priority;
 
    luxjob[jobnum].mode = mode;
 
    luxjob[jobnum].spp = spp;
 
    luxjob[jobnum].frameset = frameset;
 
    // handle lux modes somehow.
 
}
 
  else{
 
    // Throw error.
 
  }
 
jobnum++;
 
}
 

	
 
/*
 
 * struct frameset[]
 
 * {
 
 *   status;
 
 * }
 
 *
 
 *
 
 */
 

	
 

	
 

	
 

	
 

	
 

	
 

	
 

	
 

	
 
/*
 
Slave execution code lies below
 

	
 

	
 
Slave listens on server for a command in the format of each function...
 
We need if's for returns... ==> watchdog
 
*/
 

	
 

	
 
// Executors
 

	
 
void exec_blender(char *input, char *output, int sframe, int eframe) {
 
void exec_blender(char *input, char *output, int frame) {
 
  int ret;
 
  /* SEGFAULTAGE :-D */
 
  char *cmd[] = { "blender", "-b", "-o", output, input, "-s", sframe, "-e", eframe, (char *)0 };
 
  char *cmd[] = { "blender", "-b", "-o", output, input, "-f", frame, (char *)0 };
 
  ret = execv("/usr/bin/blender", cmd);
 
}
 
 
  // OHNOBINKI! ... check this... Its supposed to send a command back to the server and run the_finisher(); function which sets the frame status to complete.
 
  fprintf{stdin, the_finisher(frame)};
 

	
 
void exec_luxrender_single(char *input, char *output) {
 
  int ret;
 
  char *cmd[] = { "luxrender", "-something", "something", "something", (char *)0 };
 
  ret = execv("/usr/bin/luxrender", cmd);
 
}
 

	
 
void exec_luxrender_anim(char *input, char *output, int sframe, int eframe, int spp) {
 
// spp is samples per pixel limitation on each frame
 
  int ret;
 
  char *cmd[] = { "luxrender", "-something", "something", "something", (char *)0 };
 
  ret = execv ("/usr/bin/luxrender", cmd);
 
}
 

	
 

	
 

	
 
  return 0;
 
}
0 comments (0 inline, 0 general)