Changeset - b173c86c5fcf
[Not reviewed]
default
0 1 0
ethanzonca - 16 years ago 2009-09-13 23:08:45

Fixed some pseudocode
1 file changed with 6 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/server/slave.c
Show inline comments
 
@@ -114,13 +114,13 @@ options_init(argc,argv,&my_cfg, myopts, 
 

	
 

	
 
/* Code-filled Variables  */
 
int jobnum;          // The job number that we're currently working
 
int framenum;        // @TODO: Remotio should fill this
 

	
 
int gotframe;        // set this to 1 after data for a job is received from the server
 
int gotframe = 0;        // set this to 1 after data for a job is received from the server
 
int busy = 0;        // Client business 1=busy 0=idle
 

	
 
char *urltoTar;      // Full URL to the server-side location of job#.tgz
 
char *pathtoTar;     // Full path to the location of the job#.tgz
 

	
 
char *urltoOutput;   // Full URL where output is posted
 
@@ -142,13 +142,15 @@ if( 1 == 0)
 

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

	
 
    char *tarcmd;
 
    char *outdir;
 
    char *jobdatapath;
 

	
 
    fprintf(stderr, "Received %d in job %d, preparing to render...\n",framenum,jobnum);
 
@@ -210,26 +212,27 @@ if(gotframe ==1)
 
    if(1==1){
 
     exec_blender(myjob, pathtoJobfile, pathtoOutput, framenum, threads); // @TODO: This warning should be fixed :D
 
    }
 

	
 
    // Consider placing the following in the exec_blender() function
 
    while(busy == 1){
 
      tell_the_server(DISTREN_REQUEST_PROGRESS);
 
      tell_the_server("DISTREN_REQUEST_PROGRESS");
 
        fprintf(stderr, "Rendering frame %d in job %d...",framenum,jobnum);
 
        sleep(5); // or not... this should be more event-driven, but should still give a heartbeat to the server
 
      }
 
    busy = 2;
 
    // busy = 1; // @TODO: When done rendering, set this.
 
     }
 
    // When blender is finished, run this...
 
      if(busy==2){
 
        fprintf(stderr, "Finished frame %d in job %d, uploading...",framenum,jobnum);
 
        char *outputurl;
 
        _distren_asprintf(&outputurl, "http://protofusion.org/distren/stor/job%d/",jobnum); // Aggregates the output url
 
        curlpost(pathtoOutput, urltoOutput); // uploads (HTML POST) the output at outputpath to the server at outputurl
 
        tell_the_server(DISTREN_REQUEST_DONEFRAME); // Tells the server that it's finished rendering this frame
 
        tell_the_server("DISTREN_REQUEST_DONEFRAME"
 
            ); // Tells the server that it's finished rendering this frame
 
        busy=0;
 
        // Slave now becomes idle, doesn't need to tell the server anything, ssh handles this.
 
      }
 

	
 
  return 0;
 
}
0 comments (0 inline, 0 general)