Changeset - 4fa20a1a4a19
[Not reviewed]
default
0 1 0
ethanzonca - 16 years ago 2009-07-06 18:26:02

Added some placeholders and other organizational things.
1 file changed with 43 insertions and 52 deletions:
0 comments (0 inline, 0 general)
src/server/distrend.c
Show inline comments
 
@@ -34,12 +34,14 @@
 

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

	
 
// 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;
 
@@ -47,8 +49,7 @@ struct distrend_config
 
  struct distrend_listen **listens; /*< Null terminated array of structs */
 
}
 

	
 

	
 
// Structures for storing job information
 
// Stores Blender Job Info
 
struct {
 
  char *name;
 
  char *submitter;
 
@@ -59,7 +60,6 @@ struct {
 
  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;
 

	
 
  // Ok... what's going on with using these??? --ethanzonca
 
  int frame_num[];
 
  char slave_name[][];
 
@@ -67,6 +67,8 @@ struct {
 

	
 
} blendjob[max];
 

	
 

	
 

	
 
/*
 
// -- Matthew's handywork --
 
// struct for storing information on each frame for a particular blender job
 
@@ -79,6 +81,39 @@ struct {
 
// -- end of Matthew's handywork --
 
*/
 

	
 

	
 

	
 
/* ********************** 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]++;
 
}
 

	
 

	
 
// **** Queuer: Adds files to the queue
 
void queue(int type, char *name, char *submitter, char *email, int priority, int mode, int spp, *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[])
 
{
 

	
 
@@ -142,7 +177,7 @@ int main(int argc, char *argv[])
 

	
 

	
 

	
 

	
 
/* ************************ Aaaaaah ************************ */
 

	
 

	
 

	
 
@@ -379,59 +414,21 @@ void status_report_generator(){
 

	
 
	}
 

	
 
// This function makes the value of the frame 2, which means its completed.
 
void the_finisher(int frame){
 
	blendjob[jobnum].frame_status[frame]++;
 
}
 

	
 
// Queuer: this function should add files to the queue
 
// Type: 0 = blender, 1 = luxrender
 
// jobnum is the current job number
 

	
 
void queue(int type, char *name, char *submitter, char *email, int priority, int mode, int spp, *frameset) {
 
  if(type == 1){
 
    blendjob[jobnum].name = name;
 
    blendjob[jobnum].submitter = submitter;
 
    blendjob[jobnum].email = email;
 
    blendjob[jobnum].priority = priority;
 
    blendjob[jobnum].frameset =  frameset;
 
  }
 
  if(type == 2){
 
    luxjob[jobnum].name = name;
 
    luxjob[jobnum].submitter = submitter;
 
    luxjob[jobnum].email = email;
 
    luxjob[jobnum].priority = priority;
 
    luxjob[jobnum].mode = mode;
 
    luxjob[jobnum].spp = spp;
 
    luxjob[jobnum].frameset = frameset;
 
    // handle lux modes somehow.
 
}
 
  else{
 
    // Throw error.
 
  }
 
jobnum++;
 
}
 

	
 

	
 

	
 

	
 

	
 

	
 

	
 

	
 

	
 

	
 
/*
 
 * --------------------------------------------------------------------
 
 * Slave code resides below.
 
 * **********************************************************************************
 
 * Slave functions / etc resides below. Wouldn't a seperate file make this easier??
 
 *
 
 * Slave listens on server for a command in the format of each function...
 
 * We need if's for returns... ==> watchdog
 
 * **********************************************************************************
 
*/
 

	
 

	
 

	
 

	
 
// Registration on server. Needs attention. Prevent account spamming.
 
// Key transfer?
 
// Set up something like: distrend -c username email@example.com
 
@@ -478,9 +475,6 @@ void registeruser(char *username, char *
 
}
 

	
 

	
 

	
 

	
 

	
 
void loginuser(char *username, int secret){
 
  // Logs into sandboxed user on zserver2 as a client, currently does nothing
 
  char buf[10];
 
@@ -515,9 +509,6 @@ void loginuser(char *username, int secre
 
}
 

	
 

	
 

	
 

	
 

	
 
// Executors
 

	
 
void exec_blender(char *input, char *output, int frame) {
0 comments (0 inline, 0 general)