diff --git a/src/server/slave.c b/src/server/slave.c --- a/src/server/slave.c +++ b/src/server/slave.c @@ -82,10 +82,10 @@ char *username; char *datadir; cfg_t * my_cfg; cfg_opt_t myopts[] = { - CFG_SIMPLE_STR("username", &username), - CFG_SIMPLE_STR("datadir", &datadir), - CFG_END() - }; + CFG_SIMPLE_STR("username", &username), + CFG_SIMPLE_STR("datadir", &datadir), + CFG_END() + }; struct options_common *commonopts; username = NULL; @@ -130,9 +130,6 @@ char *pathtoXml; // Full path to the char *pathtoOutput; // Full path to the output (rendered) file char *outputExt; // Output Extension (e.g., JPG) -int threads = sysconf(_SC_NPROCESSORS_ONLN); // Equals the number of currently online processors -// FOR Win32: int threads = sysinfo.dwNumberOfProcessors; - struct distrenjob *myjob; // Structure to hold data gathered from the XML file /* If the server says that every frame for jobnum is finished */ @@ -210,26 +207,17 @@ if(gotframe ==1) /** Series of IF's for jobtype based on xml content */ if(1==1){ - exec_blender(myjob, pathtoJobfile, pathtoOutput, framenum, threads); // @TODO: This warning should be fixed :D - } - - // 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 - } - busy = 2; - // busy = 1; // @TODO: When done rendering, set this. + exec_blender(myjob, pathtoJobfile, pathtoOutput, framenum); // @TODO: This warning should be fixed :D } // When blender is finished, run this... - if(busy==2){ - fprintf(stderr, "Finished frame %d in job %d, uploading...",framenum,jobnum); - curlpost(pathtoOutput, urltoOutput); // uploads (HTML POST) the output at outputpath to the server at outputurl - tell_the_server(DISTREN_REQUEST_DONEFRAME); // Tells the server that it's finished rendering this frame - busy=0; - // Slave now becomes idle, doesn't need to tell the server anything, ssh handles this. - } + fprintf(stderr, "Finished frame %d in job %d, uploading...",framenum,jobnum); + curlpost(pathtoOutput, urltoOutput); // uploads (HTML POST) the output at outputpath to the server at outputurl + tell_the_server(DISTREN_REQUEST_DONEFRAME); // Tells the server that it's finished rendering this frame + busy=0; + // Slave now becomes idle, doesn't need to tell the server anything, ssh handles this. + +} + return 0; } diff --git a/src/server/slavefuncs.c b/src/server/slavefuncs.c --- a/src/server/slavefuncs.c +++ b/src/server/slavefuncs.c @@ -411,7 +411,7 @@ return 1; // Success /** Executor function for Blender operations */ -void exec_blender(struct distrenjob* distrenjob, char *input, char *output, int frame, int threads) +void exec_blender(struct distrenjob* distrenjob, char *input, char *output, int frame) { int ret; char *frame_str; @@ -439,12 +439,21 @@ void exec_blender(struct distrenjob* dis } execio_close(testrem); /* end execio code */ + if(ret == 1){ fprintf(stderr,"Error starting Blender. Check your install.\n"); } else{ fprintf(stderr,"Blender at least started nicely, we don't know if it rendered anything though.\n"); } + // Consider placing the following in the exec_blender() function + while(busy){ + 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 + } + + } void xmlinit() diff --git a/src/server/slavefuncs.h b/src/server/slavefuncs.h --- a/src/server/slavefuncs.h +++ b/src/server/slavefuncs.h @@ -36,7 +36,7 @@ int ssh_keygen(); int register_user(char *username, char *email); int login_user(char *username); int conf_replace(char *username); -void exec_blender(struct distrenjob* distrenjob, char *input, char *output, int frame, int threads); +void exec_blender(struct distrenjob* distrenjob, char *input, char *output, int frame); void xmlinit(); void xmlcleanup();