Changeset - 782760533a6d
[Not reviewed]
default
0 1 0
Nathan Brink (binki) - 16 years ago 2009-07-09 00:44:43
ohnobinki@ohnopublishing.net
fixed first reference to strut frameset
1 file changed with 3 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/server/distrend.c
Show inline comments
 
@@ -20,116 +20,116 @@
 

	
 
/* This file contains the code which both processes (renders) jobs as a slave, and the code which distributes frames to slaves after receiving them from the client portion of the codebase. */
 

	
 
 /* Just some notes -- Ethan Zonca
 
 * ++ Make data availible for other apps to parse
 
 * Server<==>Client Communication
 
 * Upload while rendering
 
 */
 

	
 

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

	
 
#define MAX_BLENDJOBS 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...
 

	
 
// Global Vars, try to cut down on these
 
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
 

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

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

	
 
// Stores Blender Job Info
 
struct blendjob {
 
  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 for stats/etc
 
  int assigned_frames; // number of assigned frames (that are not yet completed) for stats/etc
 
  int total_frames; // how many frames are in the animation for stats/etc
 
  struct frameset **frameset;
 
} blendjob[MAX_BLENDJOBS];
 

	
 

	
 
// Matt's code for framesets? I think that the int frame_num is obselete because it will be frameset[framenum]
 
// struct for storing information on each frame for a particular blender job
 
struct {
 
struct frameset {
 
	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
 

	
 

	
 

	
 

	
 
/* ********************** Functions ************************* */
 

	
 
// **** Finish-Setter: Sets a frame to the "completed" status. Should be modified to set =2 rather than ++ ?
 
void finish_frame(int frame){
 
	blendjob[jobnum].frame_status[frame]++;
 
  (*blendjob[jobnum].frameset)[frame].frame_status = 2;
 
}
 

	
 

	
 
// **** Queuer: Adds files to the queue
 
void queue(int type, char *name, char *submitter, char *email, int priority, int mode, int spp, *frameset) {
 
void queue(int type, char *name, char *submitter, char *email, int priority, int mode, int spp, struct frameset *frameset) {
 
	// Type: 1 = blender, add more types later
 
	// jobnum is the next available job number
 
	if(type == 1){
 
    blendjob[jobnum].name = name;
 
    blendjob[jobnum].submitter = submitter;
 
    blendjob[jobnum].email = email;
 
    blendjob[jobnum].priority = priority;
 
    blendjob[jobnum].frameset =  frameset;
 
  }
 
  else{
 
    // Throw error.
 
  }
 
jobnum++; // Advance the jobnumber for the next queued job
 
}
 

	
 

	
 

	
 

	
 

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

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

	
 
// 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
 
	    };
 

	
 
	  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);
0 comments (0 inline, 0 general)