IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4575


Ignore:
Timestamp:
Jul 16, 2005, 11:01:59 AM (21 years ago)
Author:
eugene
Message:

cleaned up status / error messages, added verbose option

Location:
trunk/Ohana/src/opihi/pcontrol
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/pcontrol/CheckBusyJob.c

    r4450 r4575  
    3434
    3535    case PCLIENT_GOOD:
    36       /* fprintf (stderr, "message received (CheckBusyJob)\n");   */
     36      if (VerboseMode()) fprintf (stderr, "message received (CheckBusyJob)\n");
    3737      break;
    3838
    3939    default:
    40       fprintf (stderr, "unknown status for pclient command: programming error\n"); 
     40      fprintf (stderr, "programming error: unknown status for pclient command\n"); 
    4141      exit (1);
    4242  }
     
    4545  p = memstr (buffer.buffer, "STATUS", buffer.Nbuffer);
    4646  if (p == NULL) {
    47     fprintf (stderr, "missing STATUS in pclient message : programming error\n");
     47    fprintf (stderr, "programming error: missing STATUS in pclient message\n");
    4848    exit (1);
    4949  }
    5050  sscanf (p, "%*s %s", string);
    5151  if (!strcmp(string, "NONE")) {
    52     fprintf (stderr, "no current job : programming error\n");
     52    fprintf (stderr, "programming error: no current job\n");
    5353    exit (1);
    5454  }
  • trunk/Ohana/src/opihi/pcontrol/CheckDoneHost.c

    r3212 r4575  
    1616      /** do we need to close the connection? **/
    1717      PutHost (host, PCONTROL_HOST_DOWN, STACK_BOTTOM);
    18       fprintf (stderr, "host %s is down\n", host[0].hostname);
     18      if (VerboseMode()) fprintf (stderr, "host %s is down\n", host[0].hostname);
    1919      FreeIOBuffer (&buffer);
    2020      return (FALSE);
     
    2222    case PCLIENT_HUNG:
    2323      PutHost (host, PCONTROL_HOST_DONE, STACK_BOTTOM);
    24       fprintf (stderr, "host %s is not responding\n", host[0].hostname);
     24      if (VerboseMode()) fprintf (stderr, "host %s is not responding\n", host[0].hostname);
    2525      FreeIOBuffer (&buffer);
    2626      return (FALSE);
    2727
    2828    case PCLIENT_GOOD:
    29       fprintf (stderr, "message received (CheckDoneHost)\n"); 
     29      if (VerboseMode()) fprintf (stderr, "message received (CheckDoneHost)\n"); 
    3030      break;
    3131
    3232    default:
    33       fprintf (stderr, "unknown status for pclient command: programming error\n"); 
     33      if (VerboseMode()) fprintf (stderr, "unknown status for pclient command: programming error\n"); 
    3434      exit (1);
    3535  }
     
    3838  p = memstr (buffer.buffer, "STATUS", buffer.Nbuffer);
    3939  if (p == NULL) {
    40     fprintf (stderr, "missing STATUS in pclient message : programming error in CheckDoneHost\n");
     40    fprintf (stderr, "programming error: missing STATUS in pclient message (CheckDoneHost)\n");
    4141    exit (1);
    4242  }
     
    4444  switch (status) {
    4545    case -1:
    46       fprintf (stderr, "reset syntax error : programming error\n");
     46      fprintf (stderr, "programming error: reset syntax error\n");
    4747      exit (1);
    4848     
    4949    case 0:
    50       fprintf (stderr, "reset failed\n");
     50      if (VerboseMode()) fprintf (stderr, "reset failed\n");
    5151      PutHost (host, PCONTROL_HOST_DONE, STACK_BOTTOM);
    5252      FreeIOBuffer (&buffer);
     
    5555    case 1:
    5656    case 2:
    57       fprintf (stderr, "successful reset\n");
     57      if (VerboseMode()) fprintf (stderr, "successful reset\n");
    5858      PutHost (host, PCONTROL_HOST_IDLE, STACK_BOTTOM);
    5959      FreeIOBuffer (&buffer);
     
    6161
    6262    default:
    63       fprintf (stderr, "programming error in CheckDoneHost (should not reach here)\n");
     63      fprintf (stderr, "programming error: should not reach here (CheckDoneHost)\n");
    6464      exit (1);
    6565  }
    66   fprintf (stderr, "programming error in CheckDoneHost (should not reach here either)\n");
     66  fprintf (stderr, "programming error: should not reach here either (CheckDoneHost)\n");
    6767  exit (1);
    6868}
  • trunk/Ohana/src/opihi/pcontrol/CheckHost.c

    r4450 r4575  
    1212  switch (status) {
    1313    case 0:
    14       fprintf (stderr, "host %s is down\n", host[0].hostname);
     14      if (VerboseMode()) fprintf (stderr, "host %s is down\n", host[0].hostname);
    1515
    1616      /* if host has a job, job is dead, push to Pending */
     
    3333     
    3434    case -1:
    35       fprintf (stderr, "host %s is not responding\n", host[0].hostname);
     35      if (VerboseMode()) fprintf (stderr, "host %s is not responding\n", host[0].hostname);
    3636      /*** do we mark this in some way (HUNG) ? ***/
    3737      PutHost (host, host[0].stack, STACK_BOTTOM);
     
    4040
    4141    default:
    42       /* fprintf (stderr, "host %s is alive\n", host[0].hostname); */
     42      if (VerboseMode()) fprintf (stderr, "host %s is alive\n", host[0].hostname);
    4343      PutHost (host, host[0].stack, STACK_BOTTOM);
    4444      FreeIOBuffer (&buffer);
    4545      return (TRUE);
    4646  }
    47   fprintf (stderr, "programming error (Check Host)\n");
     47  fprintf (stderr, "programming error: should not reach here (Check Host)\n");
    4848  return (FALSE);
    4949}
  • trunk/Ohana/src/opihi/pcontrol/GetJobOutput.c

    r4573 r4575  
    3838  switch (status) {
    3939    case -1:
    40       fprintf (stderr, "host %s is not responding\n", host[0].hostname);
     40      if (VerboseMode()) fprintf (stderr, "host %s is not responding\n", host[0].hostname);
    4141      return (FALSE);
    4242
    4343    case 0:
    44       fprintf (stderr, "host %s is down\n", host[0].hostname);
     44      if (VerboseMode()) fprintf (stderr, "host %s is down\n", host[0].hostname);
    4545      return (FALSE);
    4646
    4747    default:
    48       fprintf (stderr, "message received (GetJobOutput : %s)\n", cmd); 
     48      if (VerboseMode()) fprintf (stderr, "message received (GetJobOutput : %s)\n", cmd); 
    4949      /* drop extra bytes from pclient (not pclient:job) */
    5050      buffer[0].Nbuffer = Nstart + Nbytes;
     
    5555  }
    5656
    57   fprintf (stderr, "programming error in GetJobOutput (should not reach here)\n");
     57  fprintf (stderr, "programming error: should not reach here (GetJobOutput)\n");
    5858  exit (1);
    5959}
  • trunk/Ohana/src/opihi/pcontrol/Makefile

    r4450 r4575  
    5050
    5151cmds = \
     52$(SDIR)/job.$(ARCH).o \
     53$(SDIR)/host.$(ARCH).o \
    5254$(SDIR)/kill.$(ARCH).o \
    5355$(SDIR)/delete.$(ARCH).o \
    5456$(SDIR)/check.$(ARCH).o \
    55 $(SDIR)/job.$(ARCH).o \
    5657$(SDIR)/status.$(ARCH).o \
    5758$(SDIR)/stdout.$(ARCH).o \
    58 $(SDIR)/host.$(ARCH).o
     59$(SDIR)/verbose.$(ARCH).o
    5960
    6061pcontrol = $(cmds) $(funcs)
  • trunk/Ohana/src/opihi/pcontrol/StartHost.c

    r3211 r4575  
    1414  pid = rconnect (command, host[0].hostname, shell, stdio);
    1515  if (!pid) {     /** failure to start **/
    16     fprintf (stderr, "failure to start %s\n", host[0].hostname);
     16    if (VerboseMode()) fprintf (stderr, "failure to start %s\n", host[0].hostname);
    1717    PutHost (host, PCONTROL_HOST_DOWN, STACK_BOTTOM);
    1818    return (FALSE);
  • trunk/Ohana/src/opihi/pcontrol/StartJob.c

    r4450 r4575  
    1313  host = (Host *) job[0].host;
    1414  if (host == NULL) {
    15     fprintf (stderr, "no assigned host : programming error\n");
     15    fprintf (stderr, "programming error: no assigned host\n");
    1616    exit (1);
    1717  }
     
    3636  switch (status) {
    3737    case PCLIENT_DOWN:
    38       fprintf (stderr, "host %s is down\n", host[0].hostname);
     38      if (VerboseMode()) fprintf (stderr, "host %s is down\n", host[0].hostname);
    3939      goto failure;
    4040
    4141    case PCLIENT_HUNG:
    42       fprintf (stderr, "host %s is not responding\n", host[0].hostname);
     42      if (VerboseMode()) fprintf (stderr, "host %s is not responding\n", host[0].hostname);
    4343      goto failure;
    4444
    4545    case PCLIENT_GOOD:
    46       fprintf (stderr, "message received (StartJob)\n"); 
     46      if (VerboseMode()) fprintf (stderr, "message received (StartJob)\n"); 
    4747      break;
    4848
    4949    default:
    50       fprintf (stderr, "unknown status for pclient command: programming error\n"); 
     50      if (VerboseMode()) fprintf (stderr, "unknown status for pclient command: programming error\n"); 
    5151      exit (1);
    5252  }
     
    5555  p = memstr (buffer.buffer, "STATUS", buffer.Nbuffer);
    5656  if (p == NULL) {
    57     fprintf (stderr, "missing STATUS in pclient message : programming error\n");
     57    fprintf (stderr, "programming error: missing STATUS in pclient message\n");
    5858    exit (1);
    5959  }
     
    6161  switch (status) {
    6262    case -1:
    63       fprintf (stderr, "error in pclient child\n");
     63      if (VerboseMode()) fprintf (stderr, "error in pclient child\n");
    6464      goto failure;
    6565
    6666    case -2:
    67       fprintf (stderr, "syntax error in pclient command : programming error\n");
     67      fprintf (stderr, "programming error: syntax error in pclient command\n");
    6868      exit (1);
    6969
    7070    case -3:
    71       fprintf (stderr, "existing child on pclient : programming error\n");
     71      fprintf (stderr, "programming error: existing child on pclient\n");
    7272      exit (1);
    7373
     
    8181  }
    8282  /* we should never reach here */
    83   fprintf (stderr, "pcontrol programming error\n");
     83  fprintf (stderr, "programming error: should not reach here (StartJob)\n");
    8484  exit (1);
    8585
  • trunk/Ohana/src/opihi/pcontrol/init.c

    r4450 r4575  
    77int check       PROTO((int, char **));
    88int status      PROTO((int, char **));
     9int verbose     PROTO((int, char **));
    910int stdout_pc   PROTO((int, char **));
    1011int stderr_pc   PROTO((int, char **));
     
    1920  {"stdout",    stdout_pc, "get stdout buffer for job"},
    2021  {"stderr",    stderr_pc, "get stderr buffer for job"},
     22  {"verbose",   verbose,   "set the verbose mode for job"},
    2123};
    2224
  • trunk/Ohana/src/opihi/pcontrol/rconnect.c

    r4573 r4575  
    2727  argv[2] = shell;
    2828  argv[3] = 0;
    29   fprintf (stderr, "%s %s %s\n", argv[0], argv[1], argv[2]);
    3029
    3130  pid = fork ();
    3231  if (!pid) { /* must be child process */
    33     fprintf (stderr, "starting remote connection to %s...", hostname);
     32    if (VerboseMode()) fprintf (stderr, "starting remote connection to %s...", hostname);
    3433
    3534    /* close the other ends of the pipes */
     
    7978    status = ReadtoIOBuffer (&buffer, stdout_fd[0]);
    8079    p = memstr (buffer.buffer, "CONNECTED", buffer.Nbuffer);
    81     /* fprintf (stderr, "%d  %d  %s\n", i, buffer.Nbuffer, buffer.buffer); */
    8280    usleep (20000);
    8381  }
    84   fprintf (stderr, "%d cycles to connect\n", i);
     82  if (VerboseMode()) fprintf (stderr, "%d cycles to connect\n", i);
    8583  if (status == 0) goto pipe_error;
    8684  if (status == -1) goto io_error;
    8785  FreeIOBuffer (&buffer);
    8886
    89   fprintf (stderr, "Connected\n");
     87  if (VerboseMode()) fprintf (stderr, "Connected\n");
    9088
    9189  stdio[0] = stdin_fd[1];
     
    10098
    10199io_error:
    102   fprintf (stderr, "timeout while connecting\n");
     100  if (VerboseMode()) fprintf (stderr, "timeout while connecting\n");
    103101  goto close_pipes;
    104102
Note: See TracChangeset for help on using the changeset viewer.