Changeset - e51f7614605c
[Not reviewed]
default
0 3 0
ethanzonca@zserver2 - 16 years ago 2010-03-07 00:50:20

Removed slave xml-filled vars and helpers
3 files changed with 4 insertions and 23 deletions:
0 comments (0 inline, 0 general)
src/server/slave.c
Show inline comments
 
@@ -117,13 +117,12 @@ int main(int argc, char *argv[])
 
  char *pathtoTar;     /* Full path to the location of the job#.tgz */
 

	
 
  char *urltoOutput;   /* Full URL where output is posted */
 
  char *pathtoOutput;  /* Full path to the output (rendered) file */
 

	
 
  char *pathtoJobfile; /* Full path to the job's main file */
 
  char *pathtoXml;     /* Full path to the job's xml file */
 
  char *outputExt;     /* Output Extension (e.g., JPG) */
 

	
 
  int haveWork = 0;
 
  int quit = 0;
 

	
 
  // Main loop
 
@@ -138,40 +137,23 @@ int main(int argc, char *argv[])
 
    if(haveWork)
 
      {
 
        fprintf(stderr,"Got work from server...\n");
 
        /* @TODO: Add remotio hooks */
 
        // 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);
 

	
 
        prepareJobPaths(jobnum, datadir, &urltoTar, &pathtoTar, &pathtoJobfile, &urltoOutput, &pathtoXml);
 
        prepareJobPaths(jobnum, datadir, &urltoTar, &pathtoTar, &pathtoJobfile, &urltoOutput);
 

	
 
        if(downloadTar(urltoTar, pathtoTar))
 
          return 1;
 

	
 
        unpackJob(pathtoTar, jobnum);
 

	
 
        /* Parses a job's XML file, puts data in the myjob struct */
 
        if(distrenjob_unserialize(&myjob, pathtoXml) == 0)
 
          {
 
            fprintf(stderr, "Well, the XML craziness may have worked. Maybe. \n");
 
            free(pathtoXml);
 

	
 
            /* Frees things up if it was successful. distrenjob_unserialize() really (usually) only fails if malloc'ing inside it fails */
 
            distrenjob_free(&myjob);
 
          }
 
        else
 
          {
 
            fprintf(stderr, "XML job data parsing has failed. Please contact a developer, or try again.\n");
 
            return 1;
 
          }
 

	
 
        /* Variable-fillers which require XML */
 
        outputExt = myjob->output_format;
 

	
 
        /* Prepares the path to the jobfile */
 
        _distren_asprintf(&pathtoOutput, "%s/job%d/output/job%d-frame%d.%s", datadir, jobnum, jobnum, framenum, outputExt );
 
        free(outputExt);
 

	
 
        /* Execute blender */
 
        if(exec_blender(pathtoJobfile, pathtoOutput, framenum))
src/server/slavefuncs.c
Show inline comments
 
@@ -454,21 +454,20 @@ int unpackJob(char *pathtoTar, int jobnu
 
  free(outdir);
 
  return 0;
 
  */
 
}
 

	
 

	
 
void prepareJobPaths(int jobnum,char *datadir, char **urltoTar,char **pathtoTar,char **pathtoJobfile,char **urltoOutput,char **pathtoXml){
 
void prepareJobPaths(int jobnum,char *datadir, char **urltoTar,char **pathtoTar,char **pathtoJobfile,char **urltoOutput){
 
  // Variable Preparation
 
  char *jobdatapath;
 
   _distren_asprintf(&jobdatapath, "job%d", jobnum);
 
   _distren_asprintf(urltoTar, "http://data.distren.org/job%d/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, "%s/%s/job.blend", datadir, jobdatapath ); // Prepares the path to the jobfile
 
   _distren_asprintf(urltoOutput, "http://distren.org/slaveUpload.php"); // 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
 
   free(jobdatapath);
 
}
 

	
 
int checkUsername(char *username){
 
  if(username == NULL || strcmp(username, "!username") == 0 ) {
 
     fprintf(stderr, "\nPlease ensure that your username is present in distrenslave.conf\n");
src/server/slavefuncs.h
Show inline comments
 
@@ -46,11 +46,11 @@ void xmlinit();
 
void xmlcleanup();
 
int distren_mkdir_recurse(char *dirname);
 
int job_build_path(char *filename, unsigned int jobnum);
 
int downloadTar(char *url, char *destinationPath);
 
int uploadOutput(char *pathtoOutput, char *urltoOutput, int jobnum, int framenum, int slavekey);
 
int unpackJob(char *pathtoTar, int jobnum);
 
void prepareJobPaths(int jobnum,char *datadir, char **urltoTar,char **pathtoTar,char **pathtoJobfile,char **urltoOutput,char **pathtoXml);
 
void prepareJobPaths(int jobnum,char *datadir, char **urltoTar,char **pathtoTar,char **pathtoJobfile,char **urltoOutput);
 
int checkUsername(char *username);
 
void slaveTest();
 

	
 
#endif
0 comments (0 inline, 0 general)