Changeset - b93f715caacb
[Not reviewed]
default
0 1 0
LordOfWar - 16 years ago 2009-10-09 16:44:09

implemented makeJobDataXML() and updateJobListXML()
1 file changed with 9 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/server/distrend.c
Show inline comments
 
@@ -70,12 +70,14 @@ struct general_info {
 
  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);
 
int makeJobDataXML(struct distrenjob *job);
 
int updateJobListXML(struct distrenjob *head);
 
int reCreateQueueFromXML(struct distrenjob *head, xmlDocPtr doc, xmlNodePtr current);
 

	
 

	
 
/* Global Vars, eliminate these */
 
jobnum_t jobnum = 0; // The next job number to create in the queue
 
int hcfjob; // Highest consecutively finished job
 
@@ -189,12 +191,13 @@ void mortition(struct distrenjob *head, 
 

	
 
  if(isJobDone) // if all frames were accounted for
 
    {
 
      distrenjob_remove(head, job);
 
      distrenjob_free(&job);
 
      general_info.jobs_in_queue--;
 
      updateJobListXML(head);
 
    }
 
  else{
 
    job->prev_frame_index = 0; // if the job isn't done, have frame_finder() start from the first frame, allowing it to see the frames that are now unassigned
 
  }
 
}
 

	
 
@@ -249,13 +252,15 @@ void prepare_distrenjob(struct distrenjo
 
    distrenjob->frameset[counter].status = FRAMESETSTATUS_UNASSIGNED;
 

	
 
    counter2++;
 
  }
 

	
 
  /* add job to queue */
 
  makeJobDataXML(distrenjob);
 
  distrenjob_enqueue(head, distrenjob);
 
  updateJobListXML(head);
 

	
 
  general_info.jobs_in_queue++;
 
}
 

	
 

	
 
/** distrenjob_enqueue: This function adds the job to the queue based on its priority */
 
@@ -302,12 +307,13 @@ void change_job_priority(struct distrenj
 
        break;
 
      }
 

	
 
      prev_job = current_job;
 
    }
 
  }
 
  updateJobListXML(head);
 
}
 

	
 
/**
 
  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()
 
@@ -474,13 +480,14 @@ int distrend_config_free(struct distrend
 

	
 
  return 0;
 
}
 
/* ************************** XML Functions ************************* */
 

	
 
// returns 1 on successful completion of xml file
 
int makeSlaveDataXML(struct distrenjob *job)
 
// creates the xml file that slaves read from, and is used to restart distren
 
int makeJobDataXML(struct distrenjob *job)
 
{
 
  xmlTextWriterPtr writer;
 
  char *tmp; // temporarily holds strings to be given to the xml writer
 

	
 
  _distren_asprintf(&tmp, "stor/job%d/job_info.xml", job->jobnum);
 

	
 
@@ -533,12 +540,13 @@ struct distrenjob *createJobFromXML(int 
 
  distrenjob->priority = atoi((char*)xmlGetProp(cur, (xmlChar*)"priority"));
 

	
 
  cur = cur->xmlChildrenNode;
 
  distrenjob->width = atoi((char*)xmlGetProp(cur, (xmlChar*)"width"));
 
  distrenjob->height = atoi((char*)xmlGetProp(cur, (xmlChar*)"number"));
 

	
 
  restoreJobState(distrenjob);
 
  return distrenjob;
 
}
 

	
 
// returns 1 if successful
 
// updates job_list.xml which lists all the jobs in the queue
 
int updateJobListXML(struct distrenjob *head)
0 comments (0 inline, 0 general)