diff --git a/src/server/slave.c b/src/server/slave.c --- a/src/server/slave.c +++ b/src/server/slave.c @@ -129,8 +129,11 @@ char *pathtoTar; // Full path to the loc char *urltoOutput; // Full URL where output is posted char *pathtoJobfile; // Full path to the job's main file +char *pathtoXml; // Full path to the job's xml file char *pathtoOutput; // Full path to the output (rendered) file +struct distrenjob *myjob; // Structure to hold data gathered from the XML file + // If the slave is getting job info... if(gotframe ==1) { @@ -150,6 +153,7 @@ 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(&pathtoXml, "%s/job%d/job%d.xml",datadir, jobnum ); // Prepares the path to the job's XML file _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 @@ -169,7 +173,17 @@ if(gotframe ==1) system(tarcmd); free(tarcmd); - // exec_blender(distrenjob, pathtoJobfile, pathtoOutput, framenum); // @TODO: Implement the xml --> struct function + // Grabs data from the XML file, throws it in the myjob struct. + if(xml2distrenjob(&myjob, pathtoXml) == 0){ + fprintf(stderr,"Well, the XML craziness may have worked. Maybe. \n"); + distrenjob_free(&myjob); // Frees things up if it was successful. xml2distrenjob() really only fails if malloc'ing inside it fails + } + else{ + fprintf(stderr,"I think the XML craziness may have failed, so I'll terminate just for fun.\n"); + return 1; + } + + exec_blender(&myjob, pathtoJobfile, pathtoOutput, framenum); // @TODO: Implement the xml --> struct function // Consider placing the following in the exec_blender() function while(busy == 1){ @@ -178,7 +192,7 @@ if(gotframe ==1) sleep(5); // or not... this should be more event-driven, but should still give a heartbeat to the server } busy = 2; - busy = 1; // When done rendering, set this. + busy = 1; // @TODO: When done rendering, set this. } // When blender is finished, run this... if(busy==2){ diff --git a/src/server/slavefuncs.c b/src/server/slavefuncs.c --- a/src/server/slavefuncs.c +++ b/src/server/slavefuncs.c @@ -54,7 +54,7 @@ xmlNodePtr xml_quickxpath(xmlXPathContex fprintf(stderr, "XPath resolution failed for ``%s'' in ``%s'' (``%s'')\n", path, xpathctxt->doc->name, xpathctxt->doc->URL); return (xmlNodePtr)NULL; } - + toreturn = *(xmlxpathobjptr->nodesetval->nodeTab); xmlXPathFreeObject(xmlxpathobjptr); @@ -340,7 +340,7 @@ return 1; // Success */ /** Executor function for Blender operations */ -void exec_blender(struct distrenjob* distrenjob, char *input, char *output, char *outputres, int frame) +void exec_blender(struct distrenjob* distrenjob, char *input, char *output, int frame) { int ret; char *frame_str; diff --git a/src/server/slavefuncs.h b/src/server/slavefuncs.h --- a/src/server/slavefuncs.h +++ b/src/server/slavefuncs.h @@ -34,7 +34,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, char *outputres, int frame); +void exec_blender(struct distrenjob* distrenjob, char *input, char *output, int frame); void xmlinit(); void xmlcleanup();