Changeset - 50729768e5d3
[Not reviewed]
default
0 1 0
ethanzonca - 16 years ago 2009-07-25 21:25:56

Sensibility infusion
1 file changed with 10 insertions and 11 deletions:
0 comments (0 inline, 0 general)
src/server/slave.c
Show inline comments
 
@@ -43,6 +43,7 @@ int jobnum;
 
char *jobname;
 
int framenum;
 

	
 

	
 
/* Parses arguments, skips if there are no args */
 
	if(argc>1
 
		&& (strcmp("-c", argv[1]) == 0))
 
@@ -99,11 +100,13 @@ options_init(argc,argv,&my_cfg, myopts, 
 
	}
 

	
 

	
 

	
 
/* Rendering code */
 
	if('slave recieves "start frame#, job#"'){
 
		fprintf(stderr, "Got frame %d in job %d, preparing to render...",framenum,jobnum);
 
		get('http://distren.protofusion.org/srv/job#.tgz');
 
		exec('tar -xvf job#.tgz /tmp/distren/job#'); // somehow
 
		exec_blender("jobname.blendfile, jobnum.framenum.JPG, jobnum"); // (check the args, we'll need to adjust for different output formats, include this in the blendjob struct later)
 
		get('http://distren.protofusion.org/srv/job%d.tgz', jobnum); // use curl
 
		exec('tar -xvf job%d.tgz /tmp/distren/job%d',jobnum,jobnum); // somehow
 
		exec_blender("jobname. blendfile, jobnum.framenum.JPG, jobnum"); // (check the args, we'll need to adjust for different output formats, include this in the blendjob struct later)
 
			while('blender is running'){
 
				slavestatus=1; // really quite pointless now, but why not. Could be nice for logging.
 
				tell_the_server(DISTREN_REQUEST_PROGRESS);
 
@@ -113,15 +116,11 @@ options_init(argc,argv,&my_cfg, myopts, 
 
		slavestatus=2; // When done rendering, set this.
 
	}
 
	if(slavestatus==2){
 
		fprintf(stderr, "Finished frame %d in job %d",framenum,jobnum);
 
		tell_the_server(DISTREN_REQUEST_DONEFRAME); // or implement this into the exec_X() functions, but that would be repetative
 
		slavestatus=0;
 
		fprintf(stderr, "Finished frame %d in job %d, uploading...",framenum,jobnum);
 
		curl_POST("/path/to/output.jpg", "http://protofusion.org/distren/output/job%d",jobnum);
 
		tell_the_server(DISTREN_REQUEST_DONEFRAME); // AKA "I'm done rendering that frame you sent me"
 
		// Slave now becomes idle, doesn't need to tell the server anything, ssh handles this.
 
	}
 
	if(slavestatus==0)
 
	  {
 
	    fprintf(stderr, "Unreachable code");
 
	    abort();
 
	  }
 

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