diff --git a/src/server/slave.c b/src/server/slave.c --- a/src/server/slave.c +++ b/src/server/slave.c @@ -112,25 +112,24 @@ options_init(argc,argv,&my_cfg, myopts, } -/* Somewhat pseudo Rendering code */ + +/* These should all be filled by remotio and other code @TODO: Make this less blender-specific and more jobtype-flexible */ +int jobnum; +int framenum; -/* These should all be filled by remotio and other code */ -int jobnum; // Filled by the server telling the client what to render -int framenum; // same as above -char *outputext = "JPG"; +/* These should be filled by the xml file that comes with a job */ +char *outputExt = "JPG"; +char *outputRes = "1600x1200"; + 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 *pathtoOutput; - - char *urltoTar; // Full URL to the server-side location of job#.tgz char *pathtoTar; // Full path to the location of the job#.tgz char *urltoOutput; // Full URL where output is posted char *pathtoJobfile; // Full path to the job's main file - +char *pathtoOutput; // Full path to the output (rendered) file // If the slave is getting job info... if(gotframe ==1) @@ -151,10 +150,16 @@ if(gotframe ==1) _distren_asprintf(&pathtoJobfile, "%s/%s/job.blend", datadir, jobdatapath ); // Prepares the path to the jobfile _distren_asprintf(&urltoOutput, "http://protofusion.org/distren/stor/job%d/output/", jobdatapath ); // Prepares the URL where output is posted - _distren_asprintf(&pathtoOutput, "%s/job%d/output/frame%d.%s", datadir, jobnum, framenum, outputext ); // Prepares the path to the jobfile + _distren_asprintf(&pathtoOutput, "%s/job%d/output/frame%d.%s", datadir, jobnum, framenum, outputExt ); // Prepares the path to the jobfile + + // Download the data if it isn't present. (prevents re-downloading for same-job frames) @TODO: Delete old job data - // Download the data - curlget(urltoTar, pathtoTar); // Downloads the Tar @TODO: add a progressbar + struct stat buffer; + int fstatus = stat(pathtoJobfile, &buffer); + if(fstatus != -1){ + fprintf(stderr, "Using cached job file...\n"); + curlget(urltoTar, pathtoTar); // Downloads the Tar @TODO: add a progressbar + } _distren_asprintf(&outdir, "/tmp/distren/job%d", jobnum); /*< @todo free() */ mkdir("/tmp/distren", 0750); @@ -164,7 +169,7 @@ if(gotframe ==1) system(tarcmd); free(tarcmd); - // exec_blender(blendjob, pathtoJobfile, pathtoOutput, framenum); // So this should grab data from the struct? I have no idea. @TODO: Ohnobinki, we should clear this up. + // exec_blender(blendjob, pathtoJobfile, pathtoOutput, framenum); // @TODO: Make a xml --> struct function // Consider placing the following in the exec_blender() function while(busy == 1){