Changeset - 96731e6c15f9
[Not reviewed]
default
0 3 0
ethanzonca - 16 years ago 2009-08-30 22:31:29

Fixed up some stuff, removed archaic code, etc
3 files changed with 19 insertions and 18 deletions:
0 comments (0 inline, 0 general)
TODO
Show inline comments
 
@@ -22,8 +22,7 @@ Slave
 
*-Add calls to remoteio, once it works or even before it works
 
 -Add code to write arguments for exec_blender based on the contents of a job's xml file
 
*-Other XML-writing/reading
 
	+Parse XML file and toss data in blendjob struct
 
	+Update exec_blender() to use the struct rather than other vars
 
	+Update exec_blender() to use some struct info, maybe.
 
 -Add errorcatchers to return in libcurl functions, can we detect 404?
 
=-Make code more flexible for different types of jobs and operating systems (such as paths, libs, etc)
 
 -Add code to allow pausing/resuming of the slave (including a running blender process)
src/server/slave.c
Show inline comments
 
@@ -113,13 +113,9 @@ options_init(argc,argv,&my_cfg, myopts, 
 

	
 

	
 

	
 
/* These should all be filled by remotio and other code @TODO: Make this less blender-specific and more jobtype-flexible... how should we go about doing this? */
 
/* Code-filled Vars, filled somewhere in the loopage  */
 
int jobnum;
 
int framenum;
 

	
 
/* These should be filled by the xml file that comes with a job @TODO: Add calls to the xml function that ohnobinki's working on */
 
char *outputExt = "JPG";
 
char *outputRes = "1600x1200";
 
int framenum; // @TODO: Remotio should fill this
 

	
 
int gotframe; // set this to 1 after data for a job is received from the server
 
int busy = 0;     // Client business 1=busy 0=idle
 
@@ -131,12 +127,17 @@ char *urltoOutput;   // Full URL where o
 
char *pathtoJobfile; // Full path to the job's main file
 
char *pathtoXml;     // Full path to the job's xml file
 
char *pathtoOutput;  // Full path to the output (rendered) file
 
char *outputExt;     // Output Extension (e.g., JPG)
 

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

	
 
// If the slave is getting job info...
 
if(gotframe ==1)
 
  {
 
    /* @TODO: fix these remoteio_read's */
 
    jobnum = remotio_read(jobnum); // Set jobnum from remoteio (we could use info from struct, but we need this info to download the xmlfile)
 
    framenum = remoteio_read(jobnum); // Set framenum from remoteio
 

	
 
    char *tarcmd;
 
    char *outdir;
 
    char *jobdatapath;
 
@@ -154,7 +155,6 @@ if(gotframe ==1)
 
    _distren_asprintf(&pathtoJobfile, "%s/%s/job.blend", datadir, jobdatapath ); // Prepares the path to the jobfile
 
    _distren_asprintf(&urltoOutput, "http://protofusion.org/distren/stor/job%d/output/", 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
 
    _distren_asprintf(&pathtoOutput, "%s/job%d/output/frame%d.%s", datadir, jobnum, framenum, outputExt ); // Prepares the path to the jobfile
 

	
 
    //  Download the data if it isn't  present. (prevents re-downloading for same-job frames) @TODO: Delete old job data
 

	
 
@@ -183,7 +183,12 @@ if(gotframe ==1)
 
      return 1;
 
    }
 

	
 
    exec_blender(&myjob, pathtoJobfile, pathtoOutput, framenum); // @TODO: Implement the xml --> struct function
 
    /* Variable-fillers which require XML */
 
    outputExt = myjob.outputFormat;
 
    _distren_asprintf(&pathtoOutput, "%s/job%d/output/frame%d.%s", datadir, jobnum, framenum, outputExt ); // Prepares the path to the jobfile
 

	
 

	
 
     exec_blender(&myjob, pathtoJobfile, pathtoOutput, framenum); // @TODO: This warning should be fixed :D
 

	
 
    // Consider placing the following in the exec_blender() function
 
    while(busy == 1){
src/server/slavefuncs.c
Show inline comments
 
@@ -335,9 +335,6 @@ return 1; // Success
 

	
 
/* Executors */
 

	
 
/*
 
  It seems that the client will need to know the job number. fixme.
 
*/
 

	
 
/** Executor function for Blender operations */
 
void exec_blender(struct distrenjob* distrenjob, char *input, char *output, int frame)
 
@@ -347,7 +344,7 @@ void exec_blender(struct distrenjob* dis
 

	
 
  /* start execio code */
 
  char *command = "blender"; // @TODO: append .exe if win32?
 
  // @TODO: Put in code for output resolution, maybe... mayyyyyyybe....
 

	
 
  char *cmd[] = { command, "-b", "-o", output, input, "-f", frame_str, (char *)NULL };
 

	
 
  char buf[10];
 
@@ -356,8 +353,8 @@ void exec_blender(struct distrenjob* dis
 

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

	
 
  ret = execio_open(&testrem, command, cmd); // This path will be absolute for testing, should be relative to install on production
 
  buf[9] = '\0'; // null-terminating the array...
 
  ret = execio_open(&testrem, command, cmd); // This path will be absolute for testing, @TODO: should be relative to install on production
 
  buf[9] = '\0';
 
  while(!execio_read(testrem, buf, 9, &readlen))
 
  	    {
 
  	      if(readlen > 9) {
 
@@ -369,10 +366,10 @@ void exec_blender(struct distrenjob* dis
 
  	execio_close(testrem);
 
  /* end execio code */
 
  	if(ret == 1){
 
  		fprintf(stderr,"Error starting Blender. Check your install.");
 
  		fprintf(stderr,"Error starting Blender. Check your install.\n");
 
  	}
 
  	else{
 
  		fprintf(stderr,"Blender at least started nicely, who knows if it rendered anything though.");
 
  		fprintf(stderr,"Blender at least started nicely, we don't know if it rendered anything though.\n");
 
  	}
 
}
 

	
0 comments (0 inline, 0 general)