Changeset - 355de37ac5f1
[Not reviewed]
default
0 2 0
ethanzonca - 16 years ago 2009-09-27 19:33:39

Minor edits
2 files changed with 15 insertions and 29 deletions:
0 comments (0 inline, 0 general)
TODO
Show inline comments
 
@@ -21,15 +21,12 @@ Master
 
Slave
 
 -Fix current bugs
 
*-Add calls to remoteio, once it works or even before it works
 
*-Other XML-writing/reading
 
	+Update exec_blender() to use some struct info, maybe. The struct is being passed to it.
 
*-Other XML-writing/reading: Update exec_blender() to use some struct info, maybe. The struct is being passed to it.
 
=-Make code more flexible for different types of jobs and operating systems (such as paths, libs, etc)
 
 -Add code to allow pausing/resuming of the slave (including a running blender process)
 
 -Add a threads variable for software that doesn't support threads (blender takes care of this by itself)
 
*-Fix line 194 (call to myjob struct that fails miserably)
 
B-Add tmpdir variable (just like the datadir variable) that is compile-time or whatever
 
*-Add code to delete old jobfiles (maybe based on timestamp, etc... make sure they're uploaded first)
 
 -Upload while rendering? Would be nice.
 
*-Finish stub to delete old job data and output
 
=-Upload while rendering
 

	
 
Options
 
 -Rewrite some stuff, try to make it simpler
src/server/distrend.c
Show inline comments
 
@@ -60,15 +60,14 @@ struct general_info {
 

	
 

	
 
/*
 
  internally defined funcs's prototypes
 
*/
 
  internally defined funcs's prototypes @TODO: Make all functions nice and proper */
 
void distrenjob_remove(struct distrenjob *head, struct distrenjob *bj);
 

	
 
struct distrenjob *distrenjob_get(struct distrenjob *head, jobnum_t jobnum);
 
void distrenjob_enqueue(struct distrenjob *head, struct distrenjob *job);
 
void mortition(struct distrenjob *head, struct distrenjob *job);
 

	
 
/* Global Vars, try to cut down on these */
 
/* Global Vars, eliminate these */
 
jobnum_t 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
 
@@ -142,7 +141,6 @@ int start_data()
 
    fprintf(stderr,"Can't find XML dump, starting up fresh.\n");
 
    return 2;
 
  }
 
  free(&buffer); // @TODO: Is this pointless?
 
}
 

	
 
/** Finish-Setter: Sets a frame to the "completed" status.*/
 
@@ -160,8 +158,7 @@ void finish_frame(struct distrenjob *hea
 
    }
 
}
 

	
 
/** mortition check to see if a job is actually done by scanning the folder of the job to make sure all frames are present*/
 
// called mortition because it checks the finished "dead" job
 
/** "mortition" check to see if a job is actually done by scanning the folder of the job to make sure all frames are present*/
 
void mortition(struct distrenjob *head, struct distrenjob *job)
 
{
 
  short int isJobDone;
 
@@ -192,9 +189,7 @@ void mortition(struct distrenjob *head, 
 
  }
 
}
 

	
 
/**
 
   creates a structure from starting data, then calls another function to actually add that struct to the queue
 
*/
 
/** creates a structure from starting data, then calls another function to actually add that struct to the queue */
 
void prepare_distrenjob(struct distrenjob *head, int type, char *name, char *submitter, char *email, int priority, int start_frame, int end_frame)
 
{
 
  int counter2;
 
@@ -226,7 +221,7 @@ void prepare_distrenjob(struct distrenjo
 
}
 

	
 

	
 
/* distrenjob_enqueue: This function adds the job to the queue based on its priority */
 
/** distrenjob_enqueue: This function adds the job to the queue based on its priority */
 
void distrenjob_enqueue(struct distrenjob *head, struct distrenjob *job) {
 
  struct distrenjob *prev_job = head; // create pointer to previous job
 
  struct distrenjob *current_job;     // create pointer to current_job (which job is being compared to)
 
@@ -247,9 +242,7 @@ void distrenjob_enqueue(struct distrenjo
 
  } /* for(current_job) */
 
}
 

	
 
/**
 
   @arg head I may end up changing the head if job == head
 
 */
 
/** Changes the priority of an existing (and maybe running) job. @arg head I may end up changing the head if job == head */
 
void change_job_priority(struct distrenjob *head, struct distrenjob *job, int new_priority){
 
  distrenjob_remove(head, job);
 
  job->priority = new_priority;
 
@@ -259,7 +252,7 @@ void change_job_priority(struct distrenj
 
  if(job->frameset[0].status == FRAMESETSTATUS_UNASSIGNED)
 
    /* if job was not yet started */
 
    distrenjob_enqueue(head, job);
 
  else{ // if job has already been started then place it before the jobs with the same priority
 
  else{ // if job has already been started, place it before the jobs with the same priority
 
    // iterate through linked list of jobs
 
    for(current_job = head; current_job != NULL; current_job = current_job->next){
 
      if(current_job == NULL){ // if it has reached the end of the list, add job there
 
@@ -278,12 +271,9 @@ void change_job_priority(struct distrenj
 
}
 

	
 
/**
 
  Frame Finder: matches your computer up with a lovely frame to render
 
  TODO: Major issue here, the client needs to know the frame number, AND the job number!
 
  Notice that this function starts by looking at the oldest job first
 

	
 
	TODO: Link this up with the main() function to check if there are frames available or not and provide jobnum/framenum to the client
 

	
 
  Frame Finder: matches your computer up with a lovely frame to render, starts looking at oldest job first
 
  @TODO: We must return both jobnum and framenum
 
  @TODO: Add calls in main()
 
  @return 0 success, other: error
 
*/
 
int find_jobframe(struct distrenjob *head, struct distrenjob **job, struct frameset **frame)
 
@@ -325,7 +315,7 @@ int find_jobframe(struct distrenjob *hea
 
  return 0;
 
}
 

	
 
/** Checks for dead, laggy, or stale slaves */
 
/** Checks for dead, latent, or stale slaves */
 
void frame_watchdog(struct distrenjob *distrenjob_head)
 
{
 
  struct distrenjob *distrenjob_ptr;
 
@@ -504,13 +494,12 @@ int main(int argc, char *argv[])
 
	      sleep(10);
 
	    }
 
	  else
 
	    /* returnnum == 0 */
 
	    remotio_send_to_client(frame->num, job->jobnum); // Pseudo-sends data to client
 
	}
 
      /* If the client states that they finished the frame */
 
      	if(clientsays == DISTREN_REQUEST_DONEFRAME){
 
      	  clientstatus = CLIENTSTATUS_IDLE; // Sets the client back to idle
 
      	  finish_frame(&head, job, frame->num); // @TODO: Check that finish_frame really gets the jobnum somehow (Matt: can we give it the pointer to the job?, if not we can use distrenjob_get(&head, jobnum))
 
      	  finish_frame(&head, job, frame->num); // @TODO: Make sure this actually works.
 
      	}
 

	
 
      distrend_action_free(action);
0 comments (0 inline, 0 general)