Changeset - eb27dfe10342
[Not reviewed]
default
0 3 0
ethanzonca - 16 years ago 2009-07-25 18:30:12

Bugfixing, found some issues we need to address.
3 files changed with 5 insertions and 3 deletions:
0 comments (0 inline, 0 general)
TODO
Show inline comments
 
The most challenging and important tasks are marked with an "*"
 
The most challenging and important tasks are marked with an "*", some items marked with initials to show who needs to fix them.
 

	
 
Master
 
*-Add calls to remotio
 
 -Write more meat into the pseudo-code main() to pull everything together
 
 -Write a stub for getting info from the tarball/validifying the tarball. Read distren-job.xml, a file in the tarball, to find out 1. which rendering system to use (that system, e.g. blender/povray, can read more specifics, such as name of file to pass to blender and frames. Options common between different systems will be handled in common as best as possible)
 
 -Write a stub for publishing file and constructing job description so that the job can be shared
 
*-Other XML-writing/reading
 
M-frame_finder() needs to return both the job number and the frame number
 

	
 
Slave
 
 -Fix current bugs
 
 -Add conf-file editing code where commented in register_user()
 
*-Add calls to remoteio, once it works or even before it works
 
*-Figure out how to get output back to the server!
 
 -Add code to write arguments for exec_blender based on the contents of a job's xml file
 
*-Other XML-writing/reading
 

	
 
Options
 
 -Rewrite some stuff, try to make it simpler
 
 -Move server and client confuse code into their individual files, rather than in the common file.
 
 -Review all confuse interfacing
 
 -Push patch for relative includes in confuse to the confuse developers
 
\ No newline at end of file
 
 -Push patch for relative includes in confuse to the confuse developers
 
 
src/server/slave.c
Show inline comments
 
@@ -69,57 +69,58 @@ int framenum;
 
	}
 
/* End arg parser */
 

	
 

	
 

	
 
/* Option getter: Creates vars to grab stuff from conf, uses the options include to grab this data */
 
char *username;
 
char *key;
 
username = NULL;
 
key = NULL;
 
cfg_t * my_cfg;
 
cfg_opt_t myopts[] = {
 
		CFG_SIMPLE_STR("username", &username),
 
		CFG_SIMPLE_STR("key", &key),
 
		CFG_END()
 
		};
 
struct options_common *commonopts;
 
options_init(argc,argv,&my_cfg, myopts, "slave", &commonopts);
 
/* End option getter */
 

	
 

	
 
/* If there's no key or username in the conf, let them know! */
 
	if(key == NULL || username == NULL){
 
		fprintf(stderr,"You didn't register! \n Please register (Invoke 'distrenslave -c <username> <emailaddr> to register) \nor add your username to distrenslave.conf");
 
	}
 
	else if(key != NULL || username != NULL){
 
		loginuser(username); // Logs in user to the server
 
	}
 
	else{
 
		fprintf(stderr,"Something is terribly wrong!!!");
 
	}
 

	
 

	
 
	if('slave recieves "start frame#, job#"'){
 
		fprintf(stderr, "Got frame %d in job %d, preparing to render...",framenum,jobnum);
 
		get('http://distren.protofusion.org/srv/job#.tgz');
 
		exec('tar -xvf job#.tgz /tmp/distren/job#'); // somehow
 
		exec_blender("jobname.blendfile, jobnum.framenum.JPG, jobnum"); // (check the args, we'll need to adjust for different output formats, include this in the blendjob struct later)
 
			while('blender is running'){
 
				slavestatus=1; // really quite pointless now, but why not. Could be nice for logging.
 
				tell_the_server(DISTREN_REQUEST_PROGRESS);
 
				fprintf(stderr, "Rendering frame %d in job %d...",framenum,jobnum);
 
				delay(1000); // or not... this should be more event-driven, but should still give a heartbeat to the server
 
			}
 
		slavestatus=2; // When done rendering, set this.
 
	}
 
	if(slavestatus==2){
 
		fprintf(stderr, "Finished frame %d in job %d",framenum,jobnum);
 
		tell_the_server(DISTREN_FINISHED_ASSIGNMENT); // or implement this into the exec_X() functions, but that would be repetative
 
		slavestatus=0;
 
	}
 
	if(slavestatus==0){
 
		tell_the_server(DISTREN_REQUEST_DONEFRAME);
 
		fprintf(stderr, "Idle. No frames to render.");
 
	}
 

	
 
  return 0;
 
}
src/server/slavefuncs.c
Show inline comments
 
@@ -68,62 +68,61 @@ void registeruser(char *username, char *
 
 /* TODO: Scan distrenslave.conf for !username and !key and replace them with "keyname" and the "username" */
 

	
 
}
 

	
 

	
 
void loginuser(char *username){
 
  // Logs into sandboxed user on zserver2 as a client, currently does nothing
 
  char buf[10];
 
  struct execio *testrem;
 
  char *execargv[] =
 
    {
 
  "ssh",
 
  "username@protofusion.org", // username must be read from the conf
 
  "-i",
 
  "username.rsa", // Key created from registeruser()
 
  "-p",
 
  "23",
 
  "echo",
 
  "hello", // This should eventually open a non-terminating connection to the server for communication
 
  (char *)NULL
 
  };
 
  size_t readlen;
 
  fprintf(stderr, "Opening stream:\n", execio_open(&testrem, "ssh", execargv));
 
  buf[9] = '\0'; // null-terminating the array...
 
  while(!execio_read(testrem, buf, 9, &readlen)) // What's with the readlen stuff?
 
    {
 
      if(readlen > 9) {
 
	fprintf(stderr, "!!!! Something is terribly wrong!\n");
 
      }
 
    buf[readlen] = '\0'; // Null-terminating the end of it again based on how large the data is?
 
    fprintf(stderr, "read \"%s\"\n", buf);
 
    }
 
  execio_close(testrem);
 
}
 

	
 

	
 
/* Executors */
 

	
 
/*
 
  It seems that the client will need to know the job number. Is finish_frame going to be on the client or the server? we gotta figure that out!
 
*/
 
void exec_blender(struct blendjob* blendjob, char *input, char *output, int frame)
 
{
 
  char *frame_str;
 
  asprintf(frame,frame_str); // GNU/*nix compatible only, fix before releasing win32, although dll for windows for asprintf exists!
 
  int ret;
 
  char *cmd[] = { "blender", "-b", "-o", output, input, "-f", frame_str, (char *)0 };
 
  ret = execv("/usr/bin/blender", cmd); // This path will be absolute for testing, should be relative to install on production
 
  finish_frame(blendjob, frame); // Is this going to be client-side or server-side?
 
}
 

	
 
/* Update me when the time comes:
 
void exec_luxrender(struct luxjob* luxjob, char *input, char *output, int frame)
 
{
 
  char *frame_str;
 
  asprintf(frame,frame_str);
 
  int ret;
 
  char *cmd[] = { "luxrender", "-b", "-o", output, input, "-f", frame_str, (char *)0 }; // Fix args later
 
  ret = execv("/usr/bin/luxrender", cmd); // Absolute for testing, relative on production
 
  finish_frame(luxjob, frame);
 
}
 
*/
0 comments (0 inline, 0 general)