Changeset - 7c67ae7c57ca
[Not reviewed]
default
0 3 0
Nathan Brink (binki) - 16 years ago 2009-08-03 21:53:54
ohnobinki@ohnopublishing.net
added datadir config to server
3 files changed with 19 insertions and 2 deletions:
0 comments (0 inline, 0 general)
etc/distrenserver.conf
Show inline comments
 
/*
 
 configuration for _this_ server
 
*/
 
me
 
{
 
  render_types = {"povray", "blender", "inkscape", "imagemagick", "dcraw"}
 
}
 

	
 
include("distrencommon.conf")
 

	
 
datadir = "/var/lib/distren"
 

	
 
listen {
 
       type = "unix"
 
       path = "/var/run/distrend.sock"
 
       port = "0770"
 
}
 
\ No newline at end of file
etc/distrenslave.conf
Show inline comments
 
slave
 
{
 
  username = "!username"
 
}
 

	
 
include("distrencommon.conf")
 

	
 
datadir = "/var/lib/distren"
src/server/distrend.c
Show inline comments
 
@@ -53,48 +53,49 @@
 
#include "execio.h"
 
#include "options.h"
 
#include "blendjob.h"
 
#include "protocol.h"
 

	
 
#include <confuse.h>
 
#include <stdio.h>
 
#include <stdlib.h>
 
#include <malloc.h>
 
#include <unistd.h> /* getopt */
 
#include <time.h>
 

	
 

	
 

	
 

	
 

	
 
/* ******************* Structs ************************ */
 

	
 
// Stores config info? editmycomment
 
struct distrend_config
 
{
 
  cfg_t *mycfg;
 
  struct options_common *options;
 
  struct distrend_listen **listens; /*< Null terminated array of structs */
 
  char *datadir;
 
};
 

	
 

	
 

	
 
/*
 
 frame[frame] Status Assignments:
 
  "NULL" - don't render me
 
  "0" - canceled
 
  "1" - unassigned
 
  "2" - assigned to slave
 
  "3" - completed by slave and uploaded
 

	
 
 Have a script crawl through each job in the arrays, priority-biased, and assign a frame to each slave.
 
 Then we will need some sort of watchdog to monitor slaves on the main server to check for stales. Maybe not worry about this for now.
 
*/
 

	
 
struct general_info {
 
	short int jobs_in_queue; //
 
	unsigned short int free_clients;
 
	unsigned short int rendering_clients;//
 
	unsigned short int total_finished_jobs; //
 
	unsigned int total_frames_rendered; //
 
} general_info;
 

	
 
@@ -442,57 +443,63 @@ void blendjob_remove(struct blendjob **h
 

	
 
  /*
 
     @lordofwar: the magic deallocation of memory ;-)
 
   */
 
  free(bj);
 
}
 

	
 

	
 
/* ************************** Main ************************* */
 

	
 

	
 
// Begin non-working framework?
 
	int distrend_do_config(int argc, char *argv[], struct distrend_config **config)
 
	{
 
	  cfg_opt_t myopts_listen[] =
 
	    {
 
	      CFG_SIMPLE_STR("type", NULL),
 
	      CFG_SIMPLE_STR("path", NULL),
 
	      CFG_SIMPLE_INT("port", NULL),
 
	      CFG_END()
 
	  };
 
	  cfg_opt_t myopts[] =
 
	    {
 
	      CFG_SEC("listen",  /* this must be imported into struct listens (which must still be declared) */
 
		      myopts_listen
 
		      ,
 
	      myopts_listen,
 
		      CFGF_MULTI),
 
      CFG_SIMPLE_STR("datadir", NULL),
 
	      CFG_END()
 
	    };
 

	
 
  fprintf(stderr, "%s:%d running config\n", __FILE__, __LINE__);
 

	
 
	  *config = malloc(sizeof(struct distrend_config));
 
  myopts[1].simple_value = &(*config)->datadir;
 
  
 
	  options_init(argc, argv, &(*config)->mycfg, myopts, "server", &(*config)->options);
 

	
 
  fprintf(stderr, "using %s as datadir\n", (*config)->datadir); 
 
  
 
	  return 0;
 
	}
 
	int distrend_config_free(struct distrend_config *config)
 
	{
 
	  options_free(config->options);
 
	  free(config);
 

	
 
	  return 0;
 
	}
 
// End non-working framework?
 

	
 
int main(int argc, char *argv[])
 
{
 

	
 
  /* TODO: Put some arg-grabbing code here */
 

	
 
  struct blendjob *head;
 

	
 
  int cont;
 
  struct distrend_listenset *listenset;
 
  struct distrend_config *config;
 

	
 
  enum clientstatus
 
  {
0 comments (0 inline, 0 general)