Changeset - 12f00f880402
[Not reviewed]
default
0 3 0
ethanzonca@localhost.localdomain - 16 years ago 2009-11-23 22:27:49
ethanzonca@localhost.localdomain
Added test code for execio, minor edits
3 files changed with 12 insertions and 8 deletions:
0 comments (0 inline, 0 general)
src/server/slave.c
Show inline comments
 
@@ -98,14 +98,14 @@ 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 */
 

	
 
  int cont = 1;
 
  int framesInLocalQueue = 1;
 
  int cont = 0;
 
  int framesInLocalQueue = 0;
 

	
 
  while(cont)
 
    {
 
    /* If we got a frame */
 
    if(framesInLocalQueue > 0)
 
      {
 
@@ -169,13 +169,13 @@ int main(int argc, char *argv[])
 
        /* Prepares the path to the jobfile */
 
        _distren_asprintf(&pathtoOutput, "%s/job%d/output/job%d-frame%d.%s", datadir, jobnum, jobnum, framenum, outputExt );
 

	
 

	
 
        /** Series of ifs for jobtype based on xml content */
 
        while(1 == 1){
 
          exec_blender(myjob, pathtoJobfile, pathtoOutput, framenum); /* @TODO: This warning should be fixed :D */
 
          exec_blender(pathtoJobfile, pathtoOutput, framenum); /* @TODO: This warning should be fixed :D */
 
          break;
 
        }
 

	
 
        /* When blender is finished, run this... */
 
        fprintf(stderr, "Finished frame %d in job %d, uploading...", framenum, jobnum);
 
        curlpost(pathtoOutput, urltoOutput); /* uploads (HTML POST) the output at outputpath to the server at outputurl */
 
@@ -187,9 +187,12 @@ int main(int argc, char *argv[])
 

	
 
    // 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);
 
    }
 
  }
 

	
 
/* Test code for execio
 
  fprintf(stderr,"Testing out execioness");
 
  exec_blender("/home/ethanzonca/Blender/houses.blend", "/home/ethanzonca/Blender/out.png", 1);
 
  */
 
  return 0;
 
}
src/server/slavefuncs.c
Show inline comments
 
@@ -211,14 +211,15 @@ return 1; // Success
 

	
 

	
 
/* Executors */
 

	
 

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

	
 
  /* start execio code */
 
  char *command = "blender"; // @TODO: append .exe if win32?
 

	
 
@@ -239,22 +240,22 @@ void exec_blender(struct distrenjob* dis
 
       }
 
       buf[readlen] = '\0';
 
       fprintf(stderr, "read \"%s\"\n", buf);
 

	
 
       // @TODO: Better location for this code?
 
      tell_the_server(DISTREN_REQUEST_PROGRESS);
 
      fprintf(stderr, "Rendering...");
 
      fprintf(stderr, "Rendering...\n");
 
    }
 
  execio_close(testrem);
 
  /* end execio code */
 

	
 
  if(ret == 1){
 
    fprintf(stderr,"Error starting Blender. Check your install.\n");
 
  }
 
  else{
 
    fprintf(stderr,"Blender at least started nicely, we don't know if it rendered anything though.\n");
 
    fprintf(stderr,"Execution was successful.\n");
 
  }
 
  // Consider placing the following in the exec_blender() function
 

	
 
}
 

	
 
void xmlinit()
src/server/slavefuncs.h
Show inline comments
 
@@ -33,11 +33,11 @@ size_t curl_writetodisk(void *ptr, size_
 
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(struct distrenjob* distrenjob, char *input, char *output, int frame);
 
void exec_blender(char *input, char *output, int frame);
 
void xmlinit();
 
void xmlcleanup();
 

	
 
#endif
0 comments (0 inline, 0 general)