Changeset - 6e74651480a0
[Not reviewed]
default
0 2 0
Nathan Brink (binki) - 16 years ago 2010-01-23 15:58:57
ohnobinki@ohnopublishing.net
clean up struct distrenjob and distrenjob_new()
2 files changed with 20 insertions and 9 deletions:
0 comments (0 inline, 0 general)
src/server/distrenjob.c
Show inline comments
 
@@ -51,25 +51,31 @@ int distrenjob_new(struct distrenjob **d
 
      *distrenjob = NULL;
 
      return 1;
 
    }
 
  *distrenjob = dj;
 

	
 
  dj->next = NULL;
 
  dj->jobnum = 0; /*< @todo there should be a central jobnum allocator and a way to save the maximum jobnumber allocated */
 
  dj->type = 1;
 
  dj->name = (char *)NULL;
 
  dj->submitter = (char *)NULL;
 
  dj->jobnum = 0; /*< @todo there should be a central jobnum allocator and a way to save the maximum jobnumber allocated */
 
  dj->priority = 0;
 

	
 
  df->output_format = (char *)NULL;
 
  dj->width = 0;
 
  dj->height = 0;
 

	
 
  dj->priority = 0;
 
  dj->completed_frames = 0;
 
  dj->assigned_frames = 0;
 
  dj->total_frames = 0;
 
  dj->prev_frame_index = -1;
 

	
 
  dj->total_render_time = 0;
 
  dj->hibernate = 0;
 
  dj->prev_frame_index = -1;
 
  dj->assigned_render_power = 0;
 
  dj->watchdog_forgiveness = 3600; // initialize watchdog forgiveness at 1 hour
 
  dj->hibernate = 0;
 
  dj->frameset = (struct frameset *)NULL; /*< @todo does frameset need to be initialized here? */
 

	
 
  return 0;
 
}
 

	
 
/**
 
@@ -277,12 +283,14 @@ int distrenjob_serialize(struct distrenj
 
  xmlTextWriterStartElement(writer, (xmlChar*)"job");
 
  xmlTextWriterWriteAttribute(writer, (xmlChar*)"name", (xmlChar*)job->name);
 
  xmlTextWriterWriteAttribute(writer, (xmlChar*)"submitter", (xmlChar*)job->submitter);
 
  _distren_asprintf(&tmp, "%d", job->priority);
 
  xmlTextWriterWriteAttribute(writer, (xmlChar*)"priority", (xmlChar*)tmp);
 
  free(tmp);
 
  xmlTextWriterWriteAttribute(writer, (xmlChar *)"output_format", (xmlChar *)job->output_format);
 
  
 

	
 
  /**
 
     write resolution element and add its attributes */
 
  xmlTextWriterStartElement(writer, (xmlChar*)"resolution");
 
  _distren_asprintf(&tmp, "%d", job->width);
 
  xmlTextWriterWriteAttribute(writer, (xmlChar*)"width", (xmlChar*)tmp);
src/server/distrenjob.h
Show inline comments
 
@@ -32,28 +32,31 @@ typedef unsigned int jobnum_t;
 
/**
 
   Stores Blender Job Info
 
*/
 
struct distrenjob
 
{
 
  struct distrenjob *next; /*< next will be NULL unless if there is another distrenjob */
 
  jobnum_t jobnum;
 
  short int type; /*< 1:Blender, 2:something else */
 
  char *name;
 
  char *submitter;
 
  jobnum_t jobnum;
 

	
 
  char *output_format; /*< currently is the file extension of the request output format. @todo make this mime-type based/not a string */
 
  unsigned int width; /*< width in pixels of the frames to be rendered */
 
  unsigned int height; /*< height in pixels of the frames to be rendered */
 

	
 
  unsigned int priority;  /*< 1 is lowest, 10 is highest, 0 means the job is done */
 
  unsigned int completed_frames; /*< number of completed frames for stats/etc */
 
  unsigned int assigned_frames; /*< number of assigned frames (that are not yet completed) for stats/etc */
 
  unsigned int total_frames; /*< how many frames are in the animation for stats/etc (unassigned frames) */
 
  int prev_frame_index; /*< the position in the array of the last frame that was assigned */
 

	
 
  time_t total_render_time; /*< total seconds of time spent on all the completed frames */
 
  unsigned long int assigned_render_power;
 
  unsigned int watchdog_forgiveness; /*< how many seconds 'til the frame is re-assigned (if client computer crashes etc); */
 
  short int hibernate; /*< @todo DOCUMENT THIS */
 
  int prev_frame_index; /*< the position in the array of the last frame that was assigned */
 
  time_t total_render_time; /*< total seconds of time spent on all the completed frames */
 
  char *output_format; /*< currently is the file extension of the request output format. @todo make this mime-type based/not a string */
 
  unsigned long int assigned_render_power;
 
  struct frameset *frameset;
 
};
 

	
 

	
 

	
 
/**
0 comments (0 inline, 0 general)