IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 19124


Ignore:
Timestamp:
Aug 19, 2008, 12:28:34 PM (18 years ago)
Author:
eugene
Message:

adding thread options to host and job

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

Legend:

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

    r18096 r19124  
    2525  PCONTROL_JOB_NEEDHOST,
    2626} JobMode;
     27
     28/** job thread options values **/
     29typedef enum {
     30  PCONTROL_JOB_THREADS_NONE,
     31  PCONTROL_JOB_THREADS_MAX,
     32} JobThreadMode;
    2733
    2834/** host status values **/
     
    106112  int         stdout_fd;
    107113  int         stderr_fd;
     114  int         max_threads;
    108115  int         markoff;
    109116  int         pid;
     
    228235Host  *PullHostFromStackByID (int StackID, IDtype ID);
    229236Host  *PullHostFromStackByName (int StackID, char *name);
    230 IDtype AddHost (char *hostname);
     237IDtype AddHost (char *hostname, int max_threads);
    231238void   DelHost (Host *host);
    232239
  • trunk/Ohana/src/opihi/pcontrol/HostOps.c

    r18113 r19124  
    189189}
    190190
    191 IDtype AddHost (char *hostname) {
     191IDtype AddHost (char *hostname, int max_threads) {
    192192
    193193  Host *host;
     
    195195  ALLOCATE (host, Host, 1);
    196196
    197   host[0].hostname  = strcreate (hostname);
    198   host[0].stdin_fd  = 0;
    199   host[0].stdout_fd = 0;
    200   host[0].stderr_fd = 0;
    201   host[0].HostID    = NextHostID();
    202 
    203   host[0].lasttry.tv_sec = 0;
     197  host[0].hostname    = strcreate (hostname);
     198  host[0].max_threads = max_threads;
     199  host[0].stdin_fd    = 0;
     200  host[0].stdout_fd   = 0;
     201  host[0].stderr_fd   = 0;
     202  host[0].HostID      = NextHostID();
     203
     204  host[0].lasttry.tv_sec  = 0;
    204205  host[0].lasttry.tv_usec = 0;
    205   host[0].nexttry.tv_sec = 0;
     206  host[0].nexttry.tv_sec  = 0;
    206207  host[0].nexttry.tv_usec = 0;
    207208
  • trunk/Ohana/src/opihi/pcontrol/StartJob.c

    r17477 r19124  
    1414
    1515  /* construct command line : job arg0 arg1 ... argN\n */
     16  // arguments of the form @MAX_THREADS@ are replaced here
    1617  Nline = 10 + job[0].argc;
    1718  for (i = 0; i < job[0].argc; i++) {
     
    2324  for (i = 0; i < job[0].argc; i++) {
    2425    strcat (line, " ");
     26    if (!strcmp (job[0].argv[i], "@MAX_THREADS@")) {
     27      char threads[10];
     28      snprintf (threads, 10, "%5d", host[0].max_threads);
     29      strcat (line, threads);
     30      continue;
     31    }
    2532    strcat (line, job[0].argv[i]);
    2633  }
     34
     35  fprintf (stderr, "command: %s\n", line);
    2736
    2837  status = PclientCommand (host, line, PCLIENT_PROMPT, PCONTROL_RESP_START_JOB);
  • trunk/Ohana/src/opihi/pcontrol/host.c

    r18098 r19124  
    33int host (int argc, char **argv) {
    44
     5  int N, max_threads;
    56  IDtype HostID;
    67  Host *host;
    78  Stack *AllHosts;
     9
     10  max_threads = 0;
     11  if ((N = get_argument (argc, argv, "-threads"))) {
     12    remove_argument (N, &argc, argv);
     13    max_threads = atoi(argv[N]);
     14    remove_argument (N, &argc, argv);
     15  }
    816
    917  if (argc != 3) goto usage;
     
    1220
    1321  if (!strcasecmp (argv[1], "ADD")) {
    14     HostID = AddHost (argv[2]);
     22    HostID = AddHost (argv[2], max_threads);
    1523    gprint (GP_LOG, "HostID: %d\n", (int) HostID);
    1624    return (TRUE);
    1725  }
     26
     27  if (max_threads) goto usage;
    1828
    1929  // this one is safe from in-flight entries: no one else pulls from OFF
     
    8797  gprint (GP_LOG, "USAGE: host (command) (hostname)\n");
    8898  gprint (GP_ERR, "  valid commands: add, on, retry, check, off, delete\n");
     99  gprint (GP_ERR, "  -threads Nthreads is optional for 'add'\n");
    89100  return (FALSE);
    90101}
  • trunk/Ohana/src/opihi/pcontrol/job.c

    r8296 r19124  
    3737  if (argc < 2) {
    3838    gprint (GP_ERR, "USAGE: job [options] (arg0) (arg1) ... (argN)\n");
     39    gprint (GP_ERR, "  arguments of the form @MAX_THREADS@ will be replaced when the job is launched\n");
    3940    FREE (Host);
    4041    return (FALSE);
Note: See TracChangeset for help on using the changeset viewer.