Changeset - 1ae1d5e6b902
[Not reviewed]
default
0 2 0
ethanzonca@localhost.localdomain - 16 years ago 2009-11-24 00:18:59
ethanzonca@localhost.localdomain
Cleanup, edits
2 files changed with 8 insertions and 19 deletions:
0 comments (0 inline, 0 general)
src/server/slave.c
Show inline comments
 
@@ -191,13 +191,12 @@ int main(int argc, char *argv[])
 
          // @TODO: Keep track of files that we were unable to upload, and upload them later
 
        }
 
        free(urltoOutput);
 
        free(pathtoOutput);
 

	
 
        tell_the_server(DISTREN_REQUEST_DONEFRAME); /* Tells the server that it's done rendering, and upload is done */
 
        /* Slave now becomes idle, doesn't need to tell the server anything, ssh handles this. */
 
      }
 
    else
 
      fprintf(stderr,"Nothing to do. Idling...\n");
 

	
 
    // If the server says that every frame for the last jobnum is finished, OR if the data is getting old
 
    if(1 == 0){
src/server/slavefuncs.c
Show inline comments
 
@@ -62,18 +62,18 @@ xmlNodePtr xml_quickxpath(xmlXPathContex
 

	
 
/** Stub for deleting job data from the disk. @TODO: unstubify me! */
 
int delete_jobdata(int jobnum, char *datadir)
 
{
 
  char *jobpath;
 
  _distren_asprintf(&jobpath, "%s/%d", datadir, jobnum);
 
  rmdir(jobpath);
 
  fprintf(stderr, "I just failed to remove all of your job data because I can only delete empty directories! Haha!\nPlease contact the dev team :D\n\tWe'd be overjoyed to know that someone was willing to try to use this in this devel/design/planning stage ;-)\n");
 
  // rmdir(jobpath);
 
  fprintf(stderr, "Please manually remove %s. Automatic removal is currently not implemented.\n", jobpath);
 
  return 0;
 
}
 

	
 
/** Stub stub stubbiness ugh @TODO: Kill me. */
 
/** Stub @TODO: Replace with remotio */
 
void tell_the_server(int stuff){
 
}
 

	
 
/** Function referenced by curlget() to write data to disk. */
 
size_t curl_writetodisk(void *ptr, size_t size, size_t nmemb, FILE *stream)
 
 {
 
@@ -106,13 +106,13 @@ int curlget(char *url, char *out){
 
  curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, curl_progress);
 
  curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, &Bar);
 
  res = curl_easy_perform(curl);
 
  curl_easy_cleanup(curl);
 
  }
 
  fprintf(stderr,"\n"); // Clears out he progressbar's carriage return
 
  return res; // 0 means OK, nonzero means AAAH badness
 
  return res; // 0 is OK, 1 is 404 or other error
 
}
 

	
 
/** Posts a file to a url with cUrl */
 
int curlpost(char *filename, char *url){
 
  char *targetname = "uploadedfile"; // Name of the target in the php file on the server (Don't change me unless you have different PHP code)
 
  CURL *curl;
 
@@ -209,56 +209,46 @@ int conf_replace(char *username){
 
return 1; // Success
 
}
 

	
 

	
 
/* Executors */
 

	
 

	
 
/** Executor function for Blender operations */
 
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?
 

	
 
  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;
 

	
 
  _distren_asprintf(&frame_str, "%i", frame);
 

	
 
  ret = execio_open(&testrem, command, cmd); // This path will be absolute for testing, @TODO: should be relative to install on production
 
  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);
 

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

	
 
  if(ret == 1){
 
    fprintf(stderr,"Error starting Blender. Check your install.\n");
 
    fprintf(stderr,"Error starting Blender. Check your path and installation.\n");
 
  }
 
  else{
 
    fprintf(stderr,"Execution was successful.\n");
 
    fprintf(stderr,"Execution of Blender was successful.\n");
 
  }
 
  // Consider placing the following in the exec_blender() function
 

	
 
}
 

	
 
void xmlinit()
 
{
 
  xmlInitParser();
 
  xmlXPathInit();
0 comments (0 inline, 0 general)