Changeset - 384331f8928e
[Not reviewed]
default
0 3 0
ethanzonca@localhost.localdomain - 16 years ago 2009-11-24 00:27:01
ethanzonca@localhost.localdomain
Added return to blender_exec
3 files changed with 7 insertions and 9 deletions:
0 comments (0 inline, 0 general)
src/server/slave.c
Show inline comments
 
@@ -162,25 +162,28 @@ int main(int argc, char *argv[])
 
          {
 
            fprintf(stderr, "I think the XML craziness may have failed, so I'll terminate just for fun.\n");
 
            return 1;
 
          }
 

	
 
        /* Variable-fillers which require XML */
 
        outputExt = myjob->output_format; /* @TODO: FIXME! <-- I WILL! */
 
        /* 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 */
 
        exec_blender(pathtoJobfile, pathtoOutput, framenum); /* @TODO: This warning should be fixed :D */
 
        if(exec_blender(pathtoJobfile, pathtoOutput, framenum)){ /* @TODO: This warning should be fixed :D */
 
            fprintf(stderr,"Error running Blender. Check your installation and/or your PATH.");
 
            return 1;
 
        }
 
        free(pathtoJobfile);
 

	
 
        /* When blender is finished, run this... */
 
        fprintf(stderr, "Finished frame %d in job %d, uploading...", framenum, jobnum);
 
        if( !curlpost(pathtoOutput, urltoOutput)){ // Uploads output
 
          fprintf(stderr,"Upload successful, removing old output...\n");
 
          remove(pathtoOutput); // Delete the file after its uploaded
 
        }
 
        else{
 
          fprintf(stderr,"Upload failed. Check your network connection. Trying again...");
 
          int tries=0;
 
          while(tries<10 && curlpost(pathtoOutput, urltoOutput)){
src/server/slavefuncs.c
Show inline comments
 
@@ -204,25 +204,25 @@ int conf_replace(char *username){
 
    rename(fileRepl, fileOrig);
 
  }
 
  fclose(fp2);
 
  fclose(fp1);
 
  fprintf(stderr,"Wrote conf file...\n");
 
return 1; // Success
 
}
 

	
 

	
 
/* Executors */
 

	
 
/** Executor function for Blender operations */
 
void exec_blender(char *input, char *output, int frame)
 
int exec_blender(char *input, char *output, int frame)
 
{
 
  fprintf(stderr,"Preparing to execute...\n");
 
  int ret;
 
  char *frame_str;
 

	
 
  char *command = "blender"; // @TODO: append .exe if win32? Do we expect this to be in the PATH?
 
  char *cmd[] = { command, "-b", "-o", output, input, "-f", frame_str, (char *)NULL };
 

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

	
 
@@ -231,30 +231,25 @@ void exec_blender(char *input, char *out
 
  ret = execio_open(&testrem, command, cmd);
 
  buf[9] = '\0';
 
  while(!execio_read(testrem, buf, 9, &readlen))
 
    {
 
      if(readlen > 9) {
 
        fprintf(stderr, "Something is terribly wrong!\n");
 
       }
 
       buf[readlen] = '\0';
 
       fprintf(stderr, "read \"%s\"\n", buf);
 
    }
 
  execio_close(testrem);
 

	
 
  if(ret == 1){
 
    fprintf(stderr,"Error starting Blender. Check your path and installation.\n");
 
  }
 
  else{
 
    fprintf(stderr,"Execution of Blender was successful.\n");
 
  }
 
  return ret;
 
}
 

	
 
void xmlinit()
 
{
 
  xmlInitParser();
 
  xmlXPathInit();
 
}
 

	
 
void xmlcleanup()
 
{
 
  xmlCleanupParser();
 
}
src/server/slavefuncs.h
Show inline comments
 
@@ -27,17 +27,17 @@
 

	
 
xmlNodePtr xml_quickxpath(xmlXPathContextPtr xpathctxt, xmlChar *path);
 
int software_updatecheck();
 
void tell_the_server(int stuff);
 
int delete_jobdata(int jobnum, char *datadir);
 
size_t curl_writetodisk(void *ptr, size_t size, size_t nmemb, FILE *stream);
 
int curlget(char *url, char *out);
 
int curlpost(char *filename, char *url);
 
int ssh_keygen();
 
int register_user(char *username, char *email);
 
int login_user(char *username);
 
int conf_replace(char *username);
 
void exec_blender(char *input, char *output, int frame);
 
int exec_blender(char *input, char *output, int frame);
 
void xmlinit();
 
void xmlcleanup();
 

	
 
#endif
0 comments (0 inline, 0 general)