Changeset - f993fd280c02
[Not reviewed]
default
0 2 0
ethanzonca@zserver2 - 16 years ago 2010-01-01 11:58:47

Minor slave updates
2 files changed with 9 insertions and 7 deletions:
0 comments (0 inline, 0 general)
src/server/slave.c
Show inline comments
 
@@ -194,13 +194,13 @@ int main(int argc, char *argv[])
 
          fprintf(stderr, "Using cached job file...\n");
 

	
 
        _distren_asprintf(&outdir, "/tmp/distren/job%d", jobnum);
 
        mkdir("/tmp/distren", 0750); /* @FIXME: Change to tmpdir once it exists */
 
        mkdir(outdir, 0750);
 

	
 
        _distren_asprintf(&tarcmd, "tar -xvf \"%s\" -C \"%s\"", pathtoTar, outdir); /* @TODO:Use a lib here! */
 
        _distren_asprintf(&tarcmd, "tar -xvf \"%s\" -C \"%s\"", pathtoTar, outdir); /* @FIXME:Use a lib here! */
 
        system(tarcmd);
 
        free(tarcmd);
 
        free(pathtoTar);
 
        free(outdir);
 

	
 
        /* Parses a job's XML file, puts data in the myjob struct */
 
@@ -217,12 +217,13 @@ int main(int argc, char *argv[])
 
            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))
 
@@ -246,21 +247,22 @@ int main(int argc, char *argv[])
 
            while(tries<=10 && curlpost(pathtoOutput, urltoOutput))
 
              {
 
                fprintf(stderr, "Upload failed. Trying again in 10 seconds... (attempt %d of 10)\n", tries);
 
                tries++;
 
                sleep(10);
 
              }
 
            // @TODO: Keep track of files that we were unable to upload, and upload them later
 
            // @FUTURE: Keep track of files that we were unable to upload, and upload them later
 
          }
 
        free(urltoOutput);
 
        free(pathtoOutput);
 

	
 
        // Tell the server that rendering and upload are complete
 
        // sendServer(DISTREN_REQUEST_DONEFRAME);
 
        sendSignal(comm_slave, DISTREN_REQUEST_DONEFRAME);
 

	
 
        // Tell the server that rendering and upload are complete of "jobjum.framenum"
 
	char *jobFrame;
 
	_distren_asprintf(&jobFrame, "%s.%s", jobnum, framenum);
 
        sendExtSignal(comm_slave, DISTREN_REQUEST_DONEFRAME, jobFrame);
 
	free(jobFrame);
 
      }
 
    else
 
      fprintf(stderr,"Nothing to do. Idling...\n");
 

	
 
    // If the server says that every frame for the last jobnum is finished, OR if the data is getting old
 
    if(1 == 0)
src/server/slavefuncs.c
Show inline comments
 
@@ -210,13 +210,13 @@ int curlpost(char *filename, char *url){
 
}
 

	
 

	
 
/** Logs the user into the server after ensuring that keys exist */
 
int login_user(char *username)
 
{
 
  // @TODO: Put some telnet-style auth code here
 
  // @TODO: Put some telnet-style auth code here unless this is obselete
 
  return 1; // success
 
}
 

	
 
/** Replaces wordtoreplace with replacewith in conffile (relative to SYSCONFDIR) */
 
int conf_replace(char *conffile, char *wordtoreplace, char *replacewith){
 
  int maxlinelen = 120;
0 comments (0 inline, 0 general)