Changeset - 0e43edb16f3f
[Not reviewed]
default
0 3 0
Ethan Zonca (ethanzonca) - 15 years ago 2010-06-26 01:19:14
e@ethanzonca.com
restored tar functionality, unpackJob() needs fixing though
3 files changed with 20 insertions and 18 deletions:
0 comments (0 inline, 0 general)
TODO
Show inline comments
 
@@ -41,7 +41,7 @@ Slave
 
  =-Make code more flexible for different types of jobs and operating systems (such as paths, libs, etc)
 
  =-Add code to allow pausing/resuming of the slave (including a running blender process) -> signal handling (SIGTSTP vs. SIGSTOP), distrenslave_control cmdline interface
 
  B-Add tmpdir variable (just like the datadir variable) that is compile-time or whatever -> simple API to allow configuration-file override while taking into account defaults set by ./configure
 
  E-Finish stub to delete old job data and output
 
  E-Add error checking and cleaner recursive deletion to delete_jobdata
 
  =-Upload finished frames' output files while rendering subsequent frames
 

	
 
  x=Add lockout of slaves below a certain version
src/server/simpleslave.c
Show inline comments
 
@@ -145,13 +145,14 @@ int main(int argc, char *argv[])
 
  char *pathtoTardir;
 

	
 
  // Temporary for uncompressed testing
 
  char *urltoJobfile;
 
  // char *urltoJobfile;
 

	
 
  char *urltoOutput;   /* Full URL where output is posted */
 
  char *pathtoOutput;  /* Full path to the output (rendered) file */
 
  char *pathtoOutdir;  /* Full path to output directory */
 
  char *pathtoRenderOutput; /* Contains blender framenum placeholder */
 

	
 
  char *urltoJobfile; /* Used if we aren't using compression */
 
  char *pathtoJob; /* Path to job data folder */
 
  char *pathtoJobfile; /* Full path to the job's main file */
 
  char *outputExt = "jpg";     /* Output Extension (e.g., JPG) */
 
@@ -196,18 +197,14 @@ 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 */
 
        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);
 
        mkdir(pathtoTardir, 0700);
 
        // int dlret = downloadTar(urltoTar, pathtoTar);
 
        int dlret = downloadTar(urltoJobfile, pathtoJobfile);
 
        int dlret = downloadTar(urltoTar, pathtoTar);
 
        //int dlret = downloadTar(urltoJobfile, pathtoJobfile);
 
        if(dlret == 0)
 
          fprintf(stderr,"Data retrieved successfully!\n");
 
        else if(dlret == 3){
 
@@ -216,10 +213,10 @@ int main(int argc, char *argv[])
 
        }
 
        else
 
          if(DEBUG)
 
            fprintf(stderr,"Using existing uncompressed data %s...\n", pathtoJobfile);
 
          //fprintf(stderr,"Using existing tarball %s...\n", pathtoTar);
 
            //fprintf(stderr,"Using existing uncompressed data %s...\n", pathtoJobfile);
 
            fprintf(stderr,"Using existing tarball %s...\n", pathtoTar);
 

	
 
        /* // Commented for decompression
 
        // Check if tar exists already
 
        struct stat jbuffer;
 
        int jstatus = stat(pathtoJobfile, &jbuffer);
 
        if(jstatus == -1){
 
@@ -228,10 +225,10 @@ int main(int argc, char *argv[])
 
          // If error unpacking tarball
 
          if(unpackJob(pathtoJob, pathtoTar)){
 
            _web_resetframe(slavekey, password, jobnum, framenum);  // Unassign the frame on the server so other slaves can render it
 
            fprintf(stderr,"Extraction failed, exiting.\n");
 
            return 1;
 
          }
 
        }
 
        */
 

	
 
        /* ignore return because directory may exist already */
 
        if(DEBUG)
src/server/slavefuncs.c
Show inline comments
 
@@ -72,13 +72,18 @@ xmlNodePtr xml_quickxpath(xmlXPathContex
 
}
 

	
 

	
 
/** Stub for deleting job data from the disk. @TODO: unstubify me! */
 
/** Deletes job data from the disk. @TODO: add error checking! */
 
int delete_jobdata(int jobnum, char *datadir)
 
{
 
  char *jobpath;
 
  char *jobcont;
 
  _distren_asprintf(&jobpath, "%s/%d", datadir, jobnum);
 
  // rmdir(jobpath);
 
  fprintf(stderr, "Please manually remove %s. Automatic removal is currently not implemented.\n", jobpath);
 
  _distren_asprintf(&jobcont, "%s/%d/*", datadir, jobnum);
 
  remove(jobcont);
 
  rmdir(jobpath);
 
  fprintf(stderr, "Removed files in %s/%d/ if everything was successful\n", jobpath, jobnum);
 
  free(jobpath);
 
  free(jobcont);
 
  return 0;
 
}
 

	
 
@@ -788,7 +793,7 @@ int unpackJob(char *outdir, char *pathto
 
  astatus = archive_read_open_filename(a, pathtoTar, 8192);
 
  if (astatus != ARCHIVE_OK)
 
    {
 
      fprintf(stderr, "error opening archive\n");
 
      fprintf(stderr, "Error opening archive!\n");
 
      return 1;
 
    }
 

	
 
@@ -799,7 +804,7 @@ int unpackJob(char *outdir, char *pathto
 
    {
 
      astatus = archive_read_next_header2(a, ae);
 
      if(astatus == ARCHIVE_WARN)
 
        fprintf(stderr, "Encountered nonfatal read error somehow\n");
 
        fprintf(stderr, "Encountered nonfatal read error somehow!\n");
 

	
 
      if(astatus == ARCHIVE_OK
 
         || astatus == ARCHIVE_WARN)
 
@@ -813,7 +818,7 @@ int unpackJob(char *outdir, char *pathto
 

	
 
  if(astatus != ARCHIVE_EOF)
 
    {
 
      fprintf(stderr, "Error reading archive\n");
 
      fprintf(stderr, "Error reading archive!\n");
 
      return 1;
 
    }
 

	
0 comments (0 inline, 0 general)