Changeset - 0ea6e0f201dc
[Not reviewed]
default
0 1 0
Nathan Brink (binki) - 16 years ago 2009-08-03 22:11:40
ohnobinki@ohnopublishing.net
added datadir variable to slave
1 file changed with 28 insertions and 8 deletions:
0 comments (0 inline, 0 general)
src/server/slave.c
Show inline comments
 
@@ -76,13 +76,16 @@ for(counter=0; counter<argc; counter++){
 

	
 
/* Option getter: Creates vars to grab stuff from conf, uses the options include to grab this data */
 
char *username;
 
username = NULL;
 
char *datadir;
 
cfg_t * my_cfg;
 
cfg_opt_t myopts[] = {
 
		CFG_SIMPLE_STR("username", &username),
 
		CFG_SIMPLE_STR("datadir", &datadir),
 
		CFG_END()
 
		};
 
struct options_common *commonopts;
 

	
 
username = NULL;
 
options_init(argc,argv,&my_cfg, myopts, "slave", &commonopts);
 
/* End option getter */
 

	
 
@@ -125,21 +128,38 @@ char *pathtoJobfile; // Full path to the
 

	
 

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

	
 
		/* 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
 
	    /**
 
	       Variable Preparation 
 
	       @todo find where to free() all of these
 
	    */
 
	    _distren_asprintf(&jobdatapath, "job%d", jobnum);
 
		_distren_asprintf(&urltoTar, "http://protofusion.org/distren/stor/job%d.tar.gz",jobnum); // Prepares URL to download from
 
		_distren_asprintf(&pathtoTar, "%s/stor/jobdata/job%d.tar.gz", datadir, jobnum); // Prepares destination to save to
 

	
 
		_distren_asprintf(&pathtoJobfile, DATAPATH "%s/job.blend", jobdatapath ); // Prepares the path to the jobfile
 
		 = DATAPATH "/stor/jobdata/output.jpg";
 
		_distren_asprintf(&pathtoJobfile, "%s/%s/job.blend", datadir, jobdatapath ); // Prepares the path to the jobfile
 
		// = DATAPATH "/stor/jobdata/output.jpg"; /*< ? */
 

	
 
		//  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?
 

	
 
		_distren_asprintf(&outdir, "/tmp/distren/job%d", jobnum); /*< @todo free() */
 
		mkdir("/tmp/distren");
 
		mkdir(outdir);
 

	
 
		_distren_asprintf(&tarcmd, "tar -xvf \"%s\" -C \"%s\"", jobdatatar, outdir);
 
		system(tarcmd);
 
		free(tarcmd);
 
		
 
		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
0 comments (0 inline, 0 general)