Changeset - 8489c0f926e6
[Not reviewed]
Merge default
0 2 0
ethanzonca - 16 years ago 2009-08-08 15:17:00

2 files changed with 14 insertions and 22 deletions:
0 comments (0 inline, 0 general)
configure.ac
Show inline comments
 
@@ -42,13 +42,13 @@ AC_TYPE_PID_T
 
AC_TYPE_SIZE_T
 

	
 
#package dependencies:
 

	
 
PKG_PROG_PKG_CONFIG(0.17.2)
 

	
 
PKG_CHECK_MODULES(DISTLIBS, libconfuse >= 2.6 libcurl)
 
PKG_CHECK_MODULES(DISTLIBS, libconfuse >= 2.6 libcurl libxml-2.0)
 
PKG_CHECK_MODULES([CHECK], [check >= 0.9.4])
 

	
 
AC_DEFINE_DIR([SYSCONFDIR], [sysconfdir], [Directory to find configuration files in])
 

	
 
AC_CONFIG_FILES([Makefile
 
src/Makefile
src/server/distrend.c
Show inline comments
 
@@ -160,32 +160,31 @@ void distrend_unlisten()
 
void remotio_send_to_client()
 
{
 
	// I am futile!
 
}
 
/** Fill variables after crash / shutdown from XML dumps */
 
void start_data(){
 

	
 
	if(1 == 0){
 
		// retrieve total_finished_jobs and total_finished_frames from xml file
 
	}
 
	else{
 
		general_info.total_finished_jobs = 0;
 
		general_info.total_frames_rendered = 0;
 
	}
 
}
 

	
 
// **** Finish-Setter: Sets a frame to the "completed" status.
 
/** Finish-Setter: Sets a frame to the "completed" status.*/
 
void finish_frame(struct blendjob *blendjob, int frame){
 
  blendjob->frameset[frame].status = 2;
 
  blendjob->frameset[frame].time_to_render = (clock() - blendjob[jobnum].frameset[frame].start_time); // Consider changing time-to-render to time-for-frame or something?
 

	
 
  general_info.total_frames_rendered++; // Increase total frames var for stats
 
}
 

	
 

	
 
// **** Queuer: Adds files to the queue
 
/** Queuer: Adds files to the queue */
 
void queue(struct blendjob *blendjob, 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->name = name;
 
    blendjob->submitter = submitter;
 
@@ -290,13 +289,13 @@ void status_report_generator(struct blen
 
    } /* while(blendjob_ptr) */
 

	
 
  general_info.jobs_in_queue = (highest_jobnum - general_info.total_finished_jobs); /*< extraneous parentheses! */
 
}
 

	
 

	
 
// **** Structure Builder: This function creates frame array based on the total number of frames to be rendered, which will then be parsed by function frame_farmer.
 
/** Structure Builder: 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(struct blendjob *job, unsigned int startframe, unsigned int numframes) {
 
  int jobnum_new = highest_jobnum + 1; /* global vars will someday leave us  */
 
  unsigned int counter;
 

	
 
	job->frameset = malloc(sizeof(struct frameset) * numframes);
 
	if(!job->frameset)
 
@@ -384,12 +383,13 @@ int frame_finder(struct blendjob *head, 
 
  *job = blendjob_ptr;
 
  *frame =  &blendjob_ptr->frameset[your_frame];
 

	
 
  return 0;
 
}
 

	
 
/** Checks for dying slaves */
 
void blend_frame_watchdog(struct blendjob *blendjob_head)
 
{
 
  unsigned short int watchdog_forgiveness; /*< seconds to wait on a frame before re-assigning it */
 
  struct blendjob *blendjob_ptr;
 
  unsigned int counter;
 

	
 
@@ -508,20 +508,22 @@ int distrend_config_free(struct distrend
 
}
 
// End non-working framework?
 

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

	
 
  /* TODO: Put some arg-grabbing code here */
 
  /* @TODO: Put some arg-grabbing code here */
 

	
 
  struct blendjob *head;
 

	
 
  int cont;
 
  struct distrend_listenset *listenset;
 
  struct distrend_config *config;
 

	
 
  start_data(); // Starts fresh or loads data from xml dump
 

	
 
  enum clientstatus
 
  {
 
    CLIENTSTATUS_UNINITIALIZED = 0,
 
    CLIENTSTATUS_BUSY = 1,
 
    CLIENTSTATUS_IDLE = 2
 
  } clientstatus;
 
@@ -538,50 +540,40 @@ int main(int argc, char *argv[])
 
      struct distren_action *action;
 
      int clientsays; /*< temporary example variable, will be replaced when we can handle messages */
 

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

	
 

	
 
      /* Somewhat Pseudo-code for basic server operation, should be more event-driven */
 

	
 
      start_data();
 
      /* Make the following code more event-driven */
 
      status_report_generator(&head);
 
      blend_frame_watchdog(head);
 

	
 

	
 
      struct frameset *frame;
 
      struct blendjob *job;
 

	
 
      /* If the client is idle (meaning a client without the "busy" status connected via ssh), all clients should be idle by default. */
 
      /* If the client is idle, must be modified for climbing through linked list of clients (client->clientnum) */
 
      if(clientstatus == CLIENTSTATUS_IDLE)
 
	{
 
	  /**
 
	      normaldotcom: learn about ``return by pointer''
 
	  */
 
	  int returnnum = frame_finder(head, &job, &frame); // give framefinder args, framefinder should return job number and frame number somehow
 
	  int returnnum = frame_finder(head, &job, &frame); // Finds a frame to render
 
	  if(returnnum)
 
	    {
 
	      fprintf(stderr,"No frames are available to render at this time");
 
	      fprintf(stderr,"No frames are available to render at this time. Idling...\n");
 
	      sleep(10);
 
	    }
 
	  else
 
	    /* returnnum == 0 */
 
	    remotio_send_to_client(frame->num, job->jobnum); // Did you actually make this function, ohnobinki? --normaldotcom
 
	    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(jobnum, framenumprevious); // make it finish the previous frame or something, why framenumprevios? Is that the whole linked list thing coming in?
 
      		finish_frame(head, jobnum); // @TODO: update so it fits the purpose of the previous line
 
      	  finish_frame(head, frame->num); // @TODO: Check that finish_frame really gets the jobnum somehow
 
      	}
 

	
 
      /* End Somewhat Pseudo-code */
 

	
 

	
 
      distrend_action_free(action);
 
    }
 

	
 
  distrend_unlisten(listenset);
 
  distrend_config_free(config);
 

	
0 comments (0 inline, 0 general)