Changeset - 3c7ddfce2c6b
[Not reviewed]
default
0 1 0
ethanzonca - 16 years ago 2009-08-03 21:14:20

Edits, started reorganization
1 file changed with 18 insertions and 9 deletions:
0 comments (0 inline, 0 general)
src/server/slave.c
Show inline comments
 
@@ -112,29 +112,38 @@ options_init(argc,argv,&my_cfg, myopts, 
 
int jobnum;   // Filled by the server telling the client what to render
 
int framenum; // same as above
 
int gotframe; // set this to 1 after data for a job is received from the server
 

	
 
int busy = 0;     // Client business 1=busy 0=idle
 

	
 
char *jobdatapath = "/path/to/job.tgz";
 
char *outputpath = "/path/to/output.jpg";
 
char *outputpath = DATAPATH "/stor/jobdata/output.jpg";
 

	
 

	
 
char *pathtoblend; // oh, blender-specific horribleness
 
char *jobdataurl;
 
char *urltoTar;  // Full URL to the server-side location of job#.tgz
 
char *pathtoTar; // Full path to the location of the job#.tgz
 

	
 
char *pathtoJobfile; // Full path to the job's main file
 

	
 

	
 
// If the slave is getting job info...
 
	if(gotframe ==1){
 
		fprintf(stderr, "Received %d in job %d, preparing to render...",framenum,jobnum);
 

	
 
		_distren_asprintf(&jobdataurl, "http://protofusion.org/distren/stor/job%d.tgz",jobnum); // Throws jobnum in jobdataurl
 
		/* Variable Preparation */
 
		_distren_asprintf(&urltoTar, "http://protofusion.org/distren/stor/job%d.tgz",jobnum); // Prepares URL to download from
 
		_distren_asprintf(&pathtoTar, DATAPATH "/stor/jobdata/job%d.tgz", jobnum); // Prepares destination to save to
 

	
 
		_distren_asprintf(&pathtoJobfile, DATAPATH "%s/job.blend", jobdatapath ); // Prepares the path to the jobfile
 

	
 

	
 
		curlget(jobdataurl, jobdatapath); // downloads job data from the url to the path stated, @TODO: add a progressbar
 
		_distren_asprintf(&pathtoblend, "%s/job.blend", jobdatapath ); // @TODO: Fix jobdatapath so it knows where to get the file for real :D
 
		exec('tar -xvf job%d.tgz /tmp/distren/job%d',jobnum,jobnum); // @TODO: How will we do this?
 
		exec_blender(blendjob, pathtoblend, outputpath, framenum); // So this should grab data from the struct? I have no idea. @TODO: Ohnobinki, we should clear this up.
 
		//  Download the data
 

	
 
		curlget(jobdataurl, pathtoTar); // Downloads the Tar @TODO: add a progressbar
 

	
 
		exec("tar -xvf" jobdatatar, /tmp/distren/job%d',jobnum,jobnum); // @TODO: How will we do this?
 
		exec_blender(blendjob, pathtoBlend, outputpath, framenum); // So this should grab data from the struct? I have no idea. @TODO: Ohnobinki, we should clear this up.
 

	
 
		// Consider placing the following in the exec_blender() function
 
			while(busy == 1){
 
				tell_the_server(DISTREN_REQUEST_PROGRESS);
 
				fprintf(stderr, "Rendering frame %d in job %d...",framenum,jobnum);
 
				sleep(5); // or not... this should be more event-driven, but should still give a heartbeat to the server
0 comments (0 inline, 0 general)