Changeset - b6511767dab2
[Not reviewed]
default
0 3 0
Ethan Zonca (ethanzonca) - 15 years ago 2010-05-28 17:22:40
e@ethanzonca.com
Added additional debug if's to make output cleaner
3 files changed with 15 insertions and 3 deletions:
0 comments (0 inline, 0 general)
etc/distrenslave.conf.in
Show inline comments
 
@@ -3,6 +3,7 @@ slave
 
  username = "!username"
 
  datadir = "@LOCALSTATEDIR@/@PACKAGE@"
 
  server = "protofusion"
 
  hostname = "protofusion.org"
 
}
 

	
 
include("distrencommon.conf")
src/server/simpleslave.c
Show inline comments
 
@@ -29,7 +29,8 @@
 
#include <sys/stat.h>
 
#include <unistd.h>
 

	
 
#define DEBUG 1
 
#define DEBUG 0
 

	
 

	
 
int main(int argc, char *argv[])
 
{
 
@@ -141,7 +142,7 @@ int main(int argc, char *argv[])
 
  char *pathtoTar;     /* Full path to the location of the job#.tgz */
 
  char *pathtoTardir;
 

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

	
 
  char *urltoOutput;   /* Full URL where output is posted */
src/server/slavefuncs.c
Show inline comments
 
@@ -41,6 +41,7 @@
 

	
 
#include <time.h>
 

	
 
#define DEBUG 0
 
/**
 
   Sends the server a single request (see protocol.h)
 
*/
 
@@ -189,6 +190,7 @@ CURLcode curlpost(char *filename, char *
 
  char *sframenum;
 
  char *sslavekey;
 

	
 
  if(DEBUG)
 
  fprintf(stderr,"Uploading to %s\n", url);
 

	
 
  _distren_asprintf(&sjobnum,"%d",jobnum);
 
@@ -315,23 +317,27 @@ int exec_blender(char *input, char *outp
 
  char *command = "blender"; // @TODO: We currently expect this to be in PATH
 
  char *cmd[] = { command, "-b", input, "-o", output, "-f", frame_str, "-t", "0", (char *)NULL }; // arguments for blender
 

	
 
  if(DEBUG)
 
  fprintf(stderr,"Preparing to execute command: %s -b %s -o %s -f %s\n", command, input, output, frame_str);
 

	
 
  char buf[20];
 
  struct execio *testrem;
 
  size_t readlen;
 

	
 
  if(DEBUG)
 
  fprintf(stderr,"Executing: %s\n", frame_str);
 

	
 
  ret = execio_open(&testrem, command, cmd);
 
  if(ret)
 
    {
 
      fprintf(stderr, "error running blender\n");
 
      fprintf(stderr, "Error running blender\n");
 
      return 1;
 
    }
 
  buf[19] = '\0';
 
  while(!execio_read(testrem, buf, 19, &readlen))
 
    {
 
       buf[readlen] = '\0';
 
       if(DEBUG)
 
       fprintf(stderr, "read \"%s\"\n", buf);
 
    }
 
  execio_close(testrem);
 
@@ -409,7 +415,11 @@ int uploadOutput(char *pathtoOutput, cha
 
  //fprintf(stderr,"Uploading output %s to url %s for job %d and frame %d for slavekey %d", pathtoOutput, urltoOutput, jobnum, framenum, slavekey);
 
  if( !curlpost(pathtoOutput, urltoOutput, jobnum, framenum, slavekey)) // Uploads output
 
    {
 
      if(DEBUG)
 
      fprintf(stderr,"Upload successful, removing old output...\n");
 
      else
 
        fprintf(stderr,"Upload completed\n");
 

	
 
      remove(pathtoOutput); // Delete the file after its uploaded
 
      return 0;
 
    }
0 comments (0 inline, 0 general)