IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 10694


Ignore:
Timestamp:
Dec 13, 2006, 8:55:19 AM (20 years ago)
Author:
eugene
Message:

added active state to tasks

Location:
trunk/Ohana/src/opihi
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/include/pantasks.h

    r9037 r10694  
    3333      TASK_COMMENT,
    3434      TASK_NMAX,
     35      TASK_ACTIVE,
    3536      TASK_TRANGE,
    3637      TASK_END,
     
    9495  int Nfailure;
    9596  int Ntimeout;
     97
     98  int active;
    9699
    97100} Task;
  • trunk/Ohana/src/opihi/pantasks/CheckTasks.c

    r8191 r10694  
    99  /** test all tasks: ready to test? ready to run? **/
    1010  while ((task = NextTask ()) != NULL) {
     11
     12    if (!task[0].active) continue;
    1113
    1214    /* ready to test? : check exec period */
  • trunk/Ohana/src/opihi/pantasks/Makefile

    r10342 r10694  
    5050$(SDIR)/task_host.$(ARCH).o \
    5151$(SDIR)/task_nmax.$(ARCH).o \
     52$(SDIR)/task_active.$(ARCH).o \
    5253$(SDIR)/task_macros.$(ARCH).o \
    5354$(SDIR)/task_trange.$(ARCH).o \
  • trunk/Ohana/src/opihi/pantasks/TaskOps.c

    r9037 r10694  
    310310  NewTask[0].Nfailure = 0;
    311311  NewTask[0].Ntimeout = 0;
     312
     313  NewTask[0].active = TRUE;
    312314  return (NewTask);
    313315}
     
    419421  if (!strcasecmp (command, "HOST"))      hash = TASK_HOST;
    420422  if (!strcasecmp (command, "NMAX"))      hash = TASK_NMAX;
     423  if (!strcasecmp (command, "ACTIVE"))    hash = TASK_ACTIVE;
    421424  if (!strcasecmp (command, "TRANGE"))    hash = TASK_TRANGE;
    422425  if (!strcasecmp (command, "STDOUT"))    hash = TASK_STDOUT;
  • trunk/Ohana/src/opihi/pantasks/controller.c

    r8548 r10694  
    1414  {"host",   controller_host,   "define host for controller"},
    1515  {"check",  controller_check,  "check controller host/job"},
    16   {"run",    controller_run,    "start controller operation"},
    17   {"stop",   controller_stop,   "stop controller (no disconnect)"},
     16  {"run",    controller_run,    "start controller operation / set run levels"},
     17  {"stop",   controller_run,    "stop controller (no disconnect)"},
    1818  {"status", controller_status, "check controller status"},
    1919  {"output", controller_output, "print controller output"},
  • trunk/Ohana/src/opihi/pantasks/controller_run.c

    r8548 r10694  
    77  IOBuffer buffer;
    88
    9   if (argc != 1) {
    10     gprint (GP_ERR, "USAGE: controller run\n");
     9  if ((argc > 2) ||
     10      get_argument (argc, argv, "help") ||
     11      get_argument (argc, argv, "-h") ||
     12      get_argument (argc, argv, "--help"))
     13  {
     14    if (!strcmp (argv[0], "run")) {
     15      gprint (GP_ERR, "USAGE: controller run [level]\n");
     16      gprint (GP_ERR, "  allowed levels:\n");
     17      gprint (GP_ERR, "  all (default) : manage machines, spawn jobs, harvest jobs\n");
     18      gprint (GP_ERR, "  reap          : manage machines, harvest jobs\n");
     19      gprint (GP_ERR, "  hosts         : manage machines, not jobs\n");
     20      gprint (GP_ERR, "  none          : all stop\n");
     21    } else {
     22      gprint (GP_ERR, "USAGE: controller stop (immediate processing halt)\n");
     23    }
    1124    return (FALSE);
    1225  }
     
    1932  }
    2033
    21   sprintf (command, "run");
     34  if (argc == 1) {
     35    strcpy (command, argv[0]);
     36  } else {
     37    sprintf (command, "run %s", argv[1]);
     38  }
     39
    2240  InitIOBuffer (&buffer, 0x100);
    2341  status = ControllerCommand (command, CONTROLLER_PROMPT, &buffer);
     
    3048  return (TRUE);
    3149}
    32 
    33 int controller_stop (int argc, char **argv) {
    34 
    35   int status;
    36   char command[1024];
    37   IOBuffer buffer;
    38 
    39   if (argc != 1) {
    40     gprint (GP_ERR, "USAGE: controller stop\n");
    41     return (FALSE);
    42   }
    43 
    44   /* check if controller is running */
    45   status = CheckControllerStatus ();
    46   if (!status) {
    47     gprint (GP_LOG, "controller is not active\n");
    48     return (TRUE);
    49   }
    50 
    51   sprintf (command, "stop");
    52   InitIOBuffer (&buffer, 0x100);
    53   status = ControllerCommand (command, CONTROLLER_PROMPT, &buffer);
    54   if (status) {
    55     gwrite (buffer.buffer, 1, buffer.Nbuffer, GP_LOG);
    56   } else {
    57     gprint (GP_LOG, "controller is not responding\n");
    58   }
    59   FreeIOBuffer (&buffer);
    60   return (TRUE);
    61 }
  • trunk/Ohana/src/opihi/pantasks/init.c

    r9037 r10694  
    55int task_host       PROTO((int, char **));
    66int task_nmax       PROTO((int, char **));
     7int task_active     PROTO((int, char **));
    78int task_trange     PROTO((int, char **));
    89int task_macros     PROTO((int, char **));
     
    2627  {"host",       task_host,    "define host machine for a task"},
    2728  {"nmax",       task_nmax,    "define maximum number of jobs for a task"},
     29  {"active",     task_active,  "define maximum number of jobs for a task"},
    2830  {"trange",     task_trange,  "define valid/invalid time periods for a task"},
    2931  {"task.exit",  task_macros,  "define exit macros for a task"},
  • trunk/Ohana/src/opihi/pantasks/task.c

    r10647 r10694  
    9696      case TASK_OPTIONS:
    9797      case TASK_PERIODS:
     98      case TASK_ACTIVE:
    9899        status = command (input, &outline, TRUE);
    99100        if (outline != NULL) free (outline);
Note: See TracChangeset for help on using the changeset viewer.