diff --git a/src/server/simpleslave.c b/src/server/simpleslave.c --- a/src/server/simpleslave.c +++ b/src/server/simpleslave.c @@ -29,6 +29,7 @@ #include #include +#define DEBUG 1 int main(int argc, char *argv[]) { @@ -177,13 +178,15 @@ int main(int argc, char *argv[]) _web_setrenderpower(slavekey, password, renderPower); } } - + if(!DEBUG) + fprintf(stderr, "Running.."); // Main loop while(!quit) { // request work - fprintf(stderr,"Requesting work...\n"); + if(DEBUG) + fprintf(stderr,"Requesting work from %s...\n", hostname); haveWork = _web_getwork(slavekey, password, &jobnum, &framenum); /* If we got a frame */ @@ -194,8 +197,8 @@ int main(int argc, char *argv[]) // jobnum = remoteio_read(jobnum); /* Set jobnum from remoteio (we could use info from struct, but we need this info to download the xmlfile */ // framenum = remoteio_read(jobnum); /* Set framenum from remoteio */ // outputExt = remotio)read(outputExt); /* Set output extension from remotio */ - - fprintf(stderr, "Preparing to render frame %d in job %d\n", framenum, jobnum); + if(DEBUG) + fprintf(stderr, "Preparing to render frame %d in job %d\n", framenum, jobnum); prepareJobPaths(jobnum, framenum, outputExt, datadir, &urltoTar, &pathtoTar, &pathtoTardir, &pathtoJob, &pathtoJobfile, &urltoJobfile, &urltoOutput, &pathtoOutput, &pathtoRenderOutput, &pathtoOutdir); //free(outputExt); @@ -203,14 +206,14 @@ int main(int argc, char *argv[]) // int dlret = downloadTar(urltoTar, pathtoTar); int dlret = downloadTar(urltoJobfile, pathtoJobfile); if(dlret == 0) - // fprintf(stderr,"Got data tarball\n"); - fprintf(stderr,"Got uncompressed data!\n"); + fprintf(stderr,"Data retrieved successfully!\n"); else if(dlret == 3){ _web_resetframe(slavekey, password, jobnum, framenum); // Unassign the frame on the server so other slaves can render it return 0; // ouput dir doesn't exist } else - fprintf(stderr,"Using existing uncompressed data %s...\n", pathtoJobfile); + if(DEBUG) + fprintf(stderr,"Using existing uncompressed data %s...\n", pathtoJobfile); //fprintf(stderr,"Using existing tarball %s...\n", pathtoTar); /* // Commented for decompression @@ -228,14 +231,19 @@ int main(int argc, char *argv[]) */ /* ignore return because directory may exist already */ - fprintf(stderr,"Creating output directory %s\n", pathtoOutdir); + if(DEBUG) + fprintf(stderr,"Creating output directory %s\n", pathtoOutdir); mkdir(pathtoOutdir, 0700); - fprintf(stderr,"Marking frame started on server... "); + + if(DEBUG) + fprintf(stderr,"Marking frame started on server... "); _web_startframe(slavekey, password, jobnum, framenum); /* Execute blender */ - fprintf(stderr,"Executing blender on file %s\n", pathtoJobfile); - fprintf(stderr,"Directing output to file %s\n", pathtoOutput); + if(DEBUG){ + fprintf(stderr,"Executing blender on file %s\n", pathtoJobfile); + fprintf(stderr,"Directing output to file %s\n", pathtoOutput); + } if(exec_blender(pathtoJobfile, pathtoRenderOutput, framenum)) { @@ -255,7 +263,10 @@ int main(int argc, char *argv[]) } else{ /* Post-execution */ - fprintf(stderr, "Finished frame %d in job %d, uploading...\n", framenum, jobnum); + if(DEBUG) + fprintf(stderr, "Finished frame %d in job %d, uploading...\n", framenum, jobnum); + else + fprintf(stderr,"Finished.\n"); uploadOutput(pathtoOutput, urltoOutput, jobnum, framenum, slavekey); // @TODO: Handle return value free(urltoOutput); @@ -267,7 +278,10 @@ int main(int argc, char *argv[]) } } else{ - fprintf(stderr,"Nothing to do. Idling...\n"); + if(DEBUG) + fprintf(stderr,"No work to do. Idling...\n"); + else + fprintf(stderr,"."); sleep(300); // Poll every 300 seconds @TODO: remove polling }