Changeset - 52bf06710be2
[Not reviewed]
default
0 1 0
ethanzonca - 16 years ago 2009-07-06 18:06:45

Moved a bit of stuff around
1 file changed with 16 insertions and 13 deletions:
0 comments (0 inline, 0 general)
src/server/distrend.c
Show inline comments
 
@@ -25,29 +25,37 @@
 
 * Server<==>Client Communication
 
 * Upload while rendering
 
 */
 

	
 

	
 
#include <stdio.h>
 
#include "execio.h"
 
#include "options.h"
 
#include <confuse.h>
 

	
 
#define max 100 // maximum number of stored jobs in memory, per job type (lux/blend). Eventually we can dump this data to disk, or atleast the remainder not in memory...
 

	
 
int jobnum = 0;
 

	
 
int jobnum = 0; // The next job number to create in the queue
 
int hcfjob; // Highest consecutively finished job
 
int highest_jobnum; // The job number of the most recently created job, this is used when creating new jobs
 

	
 
int highest_jobnum; // The job number of the most recently created job, this is used when creating new jobs
 

	
 

	
 
struct distrend_config
 
{
 
  cfg_t *mycfg;
 
  struct options_common *options;
 
  struct distrend_listen **listens; /*< Null terminated array of structs */
 
}
 

	
 

	
 
// Structures for storing job information
 
struct {
 
  char *name;
 
  char *submitter;
 
  char *email;
 
  int priority;  // 1 is lowest, 10 is highest, 0 is done
 
  int percent_done;
 
  int completed_frames; // number of completed frames
 
  int assigned_frames; // number of assigned frames (that are not yet completed)
 
  int total_frames; // how many frames are in the animation
 
  struct frameset **frameset;
 
@@ -65,25 +73,25 @@ struct {
 
struct {
 
	int frame_num; // frame number to render
 
	char slave_name; // user that frame is assigned to
 
	int frame_status; // status of frame, 0= unassigned, 1= taken, 2= done
 
} frameset[]; // Frameset array is generated by status_report_generator function
 
                         // Using this method to save memory, because if animation starts on a high frame number, it would waste a lot of RAM on empty structures
 
// -- end of Matthew's handywork --
 
*/
 

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

	
 
// I'm assuming this is a non-working framework :)
 
// Begin non-working framework?
 
	int distrend_do_config(int argc, char *argv[], struct distrend_config *config)
 
	{
 
	  cfg_opt_t myopts =
 
	    {
 
	      CFG_SEC("listen",  /* this must be imported into struct listens (which must still be declared) */
 
	    {
 
	      CFG_SIMPLE_STR("type", NULL),
 
		CFG_SIMPLE_STR("path", NULL),
 
		CFG_SIMPLE_INT("port", NULL)
 
		},
 
		      CFGF_MULTI),
 
	      CFG_END
 
@@ -92,82 +100,77 @@ int main(int argc, char *argv[])
 
	  config = malloc(sizeof(struct distrend_config));
 
	  options_init(argc, argv, &config->mycfg, &myopts, "server", &config->options);
 

	
 
	  return 0;
 
	}
 
	int distrend_config_free(struct distrend_config *config)
 
	{
 
	  options_free(config->options);
 
	  free(config);
 

	
 
	  return 0;
 
	}
 

	
 
// End non-working framework?
 

	
 

	
 

	
 
  int cont = 1;
 
  struct distrend_listenset *listenset;
 
  struct distrend_config *config;
 
  distrend_do_config(argc, argv, &config);
 

	
 
  distrend_listen(&listenset, config);
 
  /* This is called the ``main loop'' */
 
  while(cont)
 
    {
 
      struct distren_action *action;
 

	
 
      distrend_accept(&action);
 
      cont = distrend_do(action);
 
      distrend_action_free(action);
 
    }
 

	
 
  distrend_unlisten(listenset);
 
  distrend_config_free(config);
 

	
 
  return 0;
 
}
 
// End main. Please take this into account when putting in code!!! Use the bracket highlighter!!!
 

	
 
struct distrend_config
 
{
 
  cfg_t *mycfg;
 
  struct options_common *options;
 

	
 
  struct distrend_listen **listens; /*< Null terminated array of structs */
 

	
 
}
 

	
 

	
 

	
 

	
 

	
 

	
 

	
 

	
 

	
 

	
 

	
 
/*
 
 frame[frame] Assignments:
 
  "NULL" - don't render me
 
  "0" - cancelled
 
  "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.
 
*/
 

	
 

	
 

	
 

	
 
/* -- Coding using OLD FRAMESET STRUCTURE... temporarily saving it!! -- :: Normaldotcom glances at lordofwar with a concerned look...
 
// This function creates frame array based on the total number of frames to be rendered, which will then be parsed by function frame_farmer.
 
void frame_num_struct_builder(int sframe, int eframe) {
 
	int jobnum_new = highest_jobnum + 1;
 
	int total = (sframe - eframe) +1;  // total number of frames
 
	int fcount = sframe; // Used to create all the frames in the structure from sframe to eframe
 
	int x = 0;
 

	
 
	blendjob[jobnum_new].total_frames = total; // sets the total number of frames in animation for status purposes
 

	
 
	while(x < total){
 
		blendjob[jobnum_new].frameset[x].frame_num = fcount;
0 comments (0 inline, 0 general)