# HG changeset patch # User ethanzonca # Date 2009-07-06 18:26:02 # Node ID 4fa20a1a4a1938471b70adac81fc977bbb1b26df # Parent 52bf06710be2d73bfed889b7637667a65ddc33e4 Added some placeholders and other organizational things. diff --git a/src/server/distrend.c b/src/server/distrend.c --- a/src/server/distrend.c +++ b/src/server/distrend.c @@ -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) {