Changeset - da918b8bbb36
[Not reviewed]
default
0 1 0
ethanzonca@localhost.localdomain - 16 years ago 2009-11-22 23:42:38
ethanzonca@localhost.localdomain
More minor edits
1 file changed with 11 insertions and 10 deletions:
0 comments (0 inline, 0 general)
src/server/slave.c
Show inline comments
 
@@ -99,18 +99,21 @@ int main(int argc, char *argv[])
 
  char *tarcmd;        /* Command to run for tar. Migrate to libtar sometime */
 
  char *outdir;        /* Output Directory for tar */
 
  char *jobdatapath;   /* Path to job data */
 

	
 
  struct distrenjob *myjob; /* Structure to hold data gathered from the XML file */
 

	
 
  /* If the server says that every frame for jobnum is finished */
 
  if(1 == 0)
 
  /* If the server says that every frame for the last jobnum is finished,
 
   * OR if the data is getting old
 
   */
 
  if(1 == 0){
 
    delete_jobdata(jobnum, datadir);
 
  }
 
  
 
  /* If the slave is getting job info... */
 
  if(gotframe == 1)
 
  /* If we got a frame */
 
  if(gotframe != 0)
 
    {
 
      /* @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 */
 
      jobnum = 0;
 
      //framenum = remoteio_read(jobnum); /* Set framenum from remoteio */
 
      framenum = 0;
 
@@ -125,24 +128,22 @@ int main(int argc, char *argv[])
 
      _distren_asprintf(&urltoTar, "http://protofusion.org/distren/stor/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://protofusion.org/distren/stor/tmp/", 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
 

	
 
      // Downloads the job tar if it isn't  present. @TODO: Delete old job data
 
      // Downloads the job tar if it isn't  present.
 
      struct stat buffer;
 
      int fstatus = stat(pathtoJobfile, &buffer);
 

	
 
      /* If stat'ing the jobfile shows that the jobfile doesn't exist, we'll download it. */
 
      if(fstatus == -1)
 
	{
 
	  /* Downloads the Tar @TODO: add progress bar */
 
	  /* Downloads the Tar */
 
	  if( curlget(urltoTar, pathtoTar) == 0)
 
	    fprintf(stderr, "File downloaded without errors\n");
 
	    fprintf(stderr, "Job data retrieved successfully\n");
 
	  else
 
	    fprintf(stderr, "Download tar from server failed. Either the server is down, or the job hosting system is screwed up.\nContact admin@protofusion.org and include this message.\nGoodbye. Better luck next time.\n");
 
	    fprintf(stderr, "Downloading job data from server failed. Check your network connection.\n");
 
	}
 
      else
 
	fprintf(stderr, "Using cached job file...\n");
 

	
 
      _distren_asprintf(&outdir, "/tmp/distren/job%d", jobnum); /*< @TODO: free() */
 
      mkdir("/tmp/distren", 0750); /* @TODO: Make this less *nix-specific */
0 comments (0 inline, 0 general)