Changeset - 18e6f04a1092
[Not reviewed]
default
0 1 0
LordOfWar - 16 years ago 2009-10-01 00:51:50

-created printAllJobnums() functions to... print all the job numbers in the queue in the order they will be processed
-added printAllJobnums to user interface
1 file changed with 19 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/server/distrend.c
Show inline comments
 
@@ -464,48 +464,64 @@ void printJob(struct distrenjob *job)
 
{
 
  int counter;
 
  printf("frame_num: status");
 
  for(counter = 0; counter < job->total_frames; counter++)
 
    {
 
      printFrameInfo(&job->frameset[counter]);
 
    }
 
}
 

	
 
void printJobInfo(struct distrenjob *job)
 
{
 
  printf("type: %d", job->type);
 
  printf("name: %s", job->email);
 
  printf("submitter: %s", job->submitter);
 
  printf("e-mail: %s", job->email);
 
  printf("priority, %d", job->priority);
 
  printf("completed: %d", job->completed_frames);
 
  printf("assigned: %d", job->assigned_frames);
 
  printf("total: %d", job->total_frames);
 
  printf("watchdog: %d", job->watchdog_forgiveness);
 
  printf("hibernate: %d", job->hibernate);
 
  printf("prev_frame: %d", job->prev_frame_index);
 
}
 

	
 
void printAllJobnums(struct distrenjob *head)
 
{
 
  struct distrenjob *current_job;
 
  int total_jobs;
 
  printf("job numbers in the order they will be processed:");
 

	
 
  total_jobs = 0;
 
  for(current_job = head; !current_job; current_job = current_job->next)
 
    {
 
      printf("%d", current_job->jobnum);
 
      total_jobs++;
 
    }
 

	
 
  printf("%d jobs in queue", total_jobs);
 
}
 

	
 
/* ************************** Main ************************* */
 

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

	
 
  /* Argument-parser */
 
  int counter = 0;
 
  int test = 0; // Have some fun if-ness that does fun stuff when this is 1
 
  int die = 0;
 

	
 
  for(counter=0; counter<argc; counter++){
 
         if(strcmp(argv[counter], "-h") == 0) {
 
           fprintf(stderr, "Usage: distrend [option] \nStarts the distrend server\n\t-h\tshow this help\n\t-t\tlaunches queue testing interface \n");
 
           return 2;
 
          }
 

	
 
          else if(strcmp(argv[counter], "-t") == 0) {
 
            fprintf(stderr, "Entering into test mode...\n\n");
 
            test=1;
 
          }
 
          else{
 
            fprintf(stderr, "Please enter some compatible args (see -h), or invoke with no args.\n\n");
 
            die=1;
 
          }
 
@@ -569,51 +585,54 @@ int main(int argc, char *argv[])
 
      scanf("%d", &jobnum);
 
      printJob(distrenjob_get(&head, jobnum));
 
      break;
 
    case 2:
 
      printf("job number:");
 
      scanf("%d", &jobnum);
 
      printJobInfo(distrenjob_get(&head, jobnum));
 
      break;
 
    case 3:
 
      find_jobframe(&head, &tmp_job, &tmp_frame);
 
      printf("job#:%d", tmp_job->jobnum);
 
      printf("frame#:%d", tmp_frame->num);
 
      break;
 
    case 4:
 
      printf("type 1:blender, 2:povray"); scanf("%d", &type);
 
      printf("name:");                    scanf("%s", name);
 
      printf("submitter");                scanf("%s", submitter);
 
      printf("e-mail");                   scanf("%s", email);
 
      printf("priority");                 scanf("%d", &priority);
 
      printf("start frame");              scanf("%d", &end_frame);
 
      printf("end frame");                scanf("%d", &start_frame);
 
      prepare_distrenjob(&head, type, name, submitter, email, priority, start_frame, end_frame);
 
      break;
 
    case 5:
 
      printf("job number:");
 
      scanf("%d", &jobnum);
 
      distrenjob_remove(&head, distrenjob_get(&head, jobnum));
 
      break;
 
    case 6:
 
      printAllJobnums(&head);
 
      break;
 
    }
 
  }
 

	
 
  distrend_listen(&listenset, config);
 
  /* This is called the "main loop" */
 
  while(cont)
 
    {
 
      struct distren_action *action;
 
      int clientsays = 0; /*< temporary example variable, will be replaced when we can handle messages */
 

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

	
 
      /* Make the following code more event-driven */
 
      frame_watchdog(&head);
 

	
 

	
 
      struct frameset *frame;
 
      struct distrenjob *job;
 

	
 
      /* If the client is idle, must be modified for climbing through linked list of clients (client->clientnum) */
 
      if(clientstatus == CLIENTSTATUS_IDLE)
 
	{
0 comments (0 inline, 0 general)