IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 32632


Ignore:
Timestamp:
Nov 8, 2011, 2:54:20 PM (15 years ago)
Author:
eugene
Message:

add nice ability to pantasks/pcontrol/pclient; add ports to pantasks_server; minor updates to dvo skycoverage, etc

Location:
trunk/Ohana/src
Files:
30 edited
5 copied

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/addstar/src/find_matches_closest.c

    r28840 r32632  
    132132    }
    133133
     134    /* this block will match a given detection to the closest object within range of that detection.
     135       XXX note that this matches ALL detections within range of the single object to that same object
     136       this is bad, but I cannot just go in linear order (ie, mark off each object as they are
     137       used).  I should make a list of all Nobj * Ndet pairs in range and choose the matches
     138       based on their separations.  UGH
     139     */
     140   
    134141    /* within match range; look for matches */
    135142    Jmin = -1;
  • trunk/Ohana/src/kapa2/src/DrawFrame.c

    r29955 r32632  
    150150}
    151151
    152 # define MIN_RANGE 1e-10
     152// do I really want this?  allow an override?
     153# define MIN_RANGE 1e-30
    153154
    154155void AxisTickScale (Axis *axis, double *major, double *minor, int *nsignif) {
  • trunk/Ohana/src/libdvo/src/dvo_set_catdir.c

    r31635 r32632  
    1515    }
    1616    if (catdir) {
    17         current_catdir = strdup(catdir);
     17        // need to keep this in the ohana memory system, so we cannot use strdup
     18        current_catdir = strcreate(catdir);
    1819    }
    1920}
  • trunk/Ohana/src/libohana/include/ohana.h

    r31663 r32632  
    2020
    2121// comment this out to avoid the internal Ohana memory management code
    22 // # define OHANA_MEMORY
     22# define OHANA_MEMORY
    2323
    2424// XXX I was including these before, but RHL claims they are not needed
  • trunk/Ohana/src/libohana/src/ohana_allocate.c

    r31663 r32632  
    112112  // memblock of supplied pointer
    113113  old = (Memblock *) in - 1;
     114
     115  if (old->startblock != OHANA_MEMMAGIC) ohana_memabort ("corrupt memory (%s, %d, %s)\n", file, line, func);
     116  if (old->endblock != OHANA_MEMMAGIC) ohana_memabort ("corrupt memory (%s, %d, %s)\n", file, line, func);
    114117
    115118  Nelem = MAX (1, Nelem);
  • trunk/Ohana/src/opihi/cmd.astro/Makefile

    r31635 r32632  
    4343$(SRC)/galprofiles.$(ARCH).o       \
    4444$(SRC)/elliprofile.$(ARCH).o       \
     45$(SRC)/ringflux.$(ARCH).o          \
    4546$(SRC)/petrosian.$(ARCH).o         \
    4647$(SRC)/multifit.$(ARCH).o          \
  • trunk/Ohana/src/opihi/cmd.astro/init.c

    r30972 r32632  
    2929int galradbins              PROTO((int, char **));
    3030int elliprofile             PROTO((int, char **));
     31int ringflux                PROTO((int, char **));
    3132int petrosian               PROTO((int, char **));
    3233int mkgauss                 PROTO((int, char **));
     
    7879  {1, "galradbins",  galradbins,   "generate radial vectors with interpolation along paths"},
    7980  {1, "elliprofile", elliprofile,  "generate radial vectors with interpolation along paths"},
     81  {1, "ringflux",    ringflux,     "mean flux in a ring"},
    8082  {1, "petrosian",   petrosian,    "petrosian parameters given radial bins"},
    8183  {1, "multifit",    multifit,     "fit multi-order spectrum"},
  • trunk/Ohana/src/opihi/cmd.data/read_vectors.c

    r31667 r32632  
    2323int read_vectors (int argc, char **argv) {
    2424 
    25   int i, j, Nskip, Nvec, *col, done, status, IsCSV;
     25    int i, j, Nskip, Nvec, *col, done, status, IsCSV, VERBOSE;
    2626  int Nbytes, nbytes, Nstart, NELEM, N, nread;
    2727  char *colstr, *c0, *c1, *buffer, *extname;
     
    5151    remove_argument (N, &argc, argv);
    5252    IsCSV = TRUE;
     53  }
     54
     55  VERBOSE = FALSE;
     56  if ((N = get_argument (argc, argv, "-v"))) {
     57    remove_argument (N, &argc, argv);
     58    VERBOSE = TRUE;
    5359  }
    5460
     
    121127    scan_line (f, buffer);
    122128  }
    123 
    124   int Nfield = 0;
    125   int Nline = 0;
    126129
    127130  Nstart = 0;
     
    157160            status = dparse (&value, col[i], c0);
    158161          }
    159           vec[i][0].elements.Flt[N] = value;
    160162          if (status) {
    161               Nfield ++;
     163              vec[i][0].elements.Flt[N] = value;
     164          } else {
     165              vec[i][0].elements.Flt[N] = NAN;
     166              if (VERBOSE) {
     167                  if (IsCSV) {
     168                      gprint (GP_ERR, "suspect field: %d (%s) in %s\n", col[i], argv[2*i+2], c0);
     169                  } else {
     170                      gprint (GP_ERR, "suspect field: %d in %s\n", col[i], c0);
     171                  }
     172              }
    162173          }
    163           if (!status) vec[i][0].elements.Flt[N] = NAN;
    164         }
    165         if (status) N++;
    166       }
    167       Nline ++;
    168       if (c1) {
    169           // fprintf (stderr, "line %d, chars %ld, fields %d\n", Nline, (c1 - c0), Nfield);
    170       }
    171       Nfield = 0;
     174        }
     175        if (status) {
     176            N++;
     177        } else {
     178            if (VERBOSE && FALSE) {
     179                char temp[32];
     180                strncpy (temp, c0, 32);
     181                temp[31] = 0;
     182                gprint (GP_ERR, "skip line %s\n\n", temp);
     183            }
     184        }
     185      }
    172186      c0 = c1 + 1;
    173187      if (N == NELEM) {
     
    177191        }
    178192      }
    179        
    180193    }
    181194  }
  • trunk/Ohana/src/opihi/cmd.data/vstats.c

    r30610 r32632  
    169169
    170170    // we are going to do another pass: mark the entries to skip
    171     pmin = max;
    172     pmax = min;
     171    pmin = min;
     172    pmax = max;
    173173    if (iter < Niter - 1) {
    174174      if (vec[0].type == OPIHI_FLT) {
     
    208208skip:
    209209  FREE(mask);
     210  if (mask) mask = NULL;
    210211
    211212  if (!Quiet) {
  • trunk/Ohana/src/opihi/dvo/skycoverage.c

    r31635 r32632  
    202202        V[ys*Nx + xs] = ShowDensity ?  0 : 2;
    203203      } else {
    204         V[ys*Nx + xs] = ShowDensity ? -1 : 0;
     204        V[ys*Nx + xs] = ShowDensity ? NAN : 0;
    205205      }
    206206    }
  • trunk/Ohana/src/opihi/include/pantasks.h

    r31667 r32632  
    4040      TASK_END,
    4141      TASK_HOST,
     42      TASK_NICE,
    4243      TASK_STDOUT,
    4344      TASK_STDERR,
     
    115116
    116117  int active;
     118  int priority;
    117119
    118120} Task;
     
    159161
    160162  JobMode     mode;                     /* local or controller? */
     163  int     priority;
    161164  char   *realhost;
    162165
  • trunk/Ohana/src/opihi/include/pcontrol.h

    r29540 r32632  
    119119  int          exit_status;
    120120  int          Reset;
     121  int          priority;
    121122  JobMode      mode;
    122123  JobStat      state;
     
    152153} Host;
    153154
     155# if (USE_LLIST)
     156typedef struct StackItem {
     157    StackItem *next;
     158    StackItem *prev;
     159    void *object;
     160    char *name;
     161    int   id;
     162} StackItem;
     163
     164/* the Jobs and Hosts are managed in a set of Stacks which define their state */
     165typedef struct {
     166    StackItem *head;
     167    StackItem *tail; // use this?
     168    int    Nobject;
     169# ifdef THREADED   
     170  pthread_mutex_t mutex;
     171# endif
     172} Stack;
     173
     174# else
     175
    154176/* the Jobs and Hosts are managed in a set of Stacks which define their state */
    155177typedef struct {
     
    163185# endif
    164186} Stack;
     187# endif
    165188
    166189/* XXX if this is hard-wired, we can't change shell name in StartHost */
     
    291314Job   *PullJobByID (IDtype JobID, int *StackID);
    292315Job   *PullJobFromStackByID (int StackID, int ID);
    293 IDtype AddJob (char *hostname, JobMode mode, int timeout, int argc, char **argv, int Nxhosts, char **xhosts);
     316IDtype AddJob (char *hostname, JobMode mode, int timeout, int priority, int argc, char **argv, int Nxhosts, char **xhosts);
    294317void   DelJob (Job *job);
    295318Host  *UnlinkJobAndHost (Job *job);
  • trunk/Ohana/src/opihi/include/shell.h

    r31667 r32632  
    184184
    185185/* socket functions */
    186 int InitServerSocket (SockAddress *Address);
     186int InitServerSocket (SockAddress *Address, char *hostname, char *portinfo);
    187187int WaitServerSocket (int InitSocket, SockAddress *Address);
    188 int GetClientSocket (char *hostname);
     188int GetClientSocket (char *hostname, char *portinfo);
    189189int InitServerSocket_Named (char *hostname, SockAddress *Address);
    190190int DefineValidIP (void);
  • trunk/Ohana/src/opihi/lib.shell/SocketOps.c

    r23530 r32632  
    11# include "shell.h"
     2# include <unistd.h>
     3# define HOST_NAME_MAX 256
    24
    35# define MY_PORT 2000
     
    1113static int *VALID;
    1214
    13 int InitServerSocket (SockAddress *Address) {
    14 
     15int GetPortRange (int *start, int *stop, char *portinfo);
     16
     17int InitServerSocket (SockAddress *Address, char *hostname, char *portinfo) {
     18
     19  int start, stop;
    1520  int status, InitSocket, length;
    16 
    17 # if (0)
    18   struct hostent  *host;
    19   char tmpline[80], hostip[80];
    20 
    21   host = gethostbyname (hostname);
    22   bzero (hostip, 80);
    23   for (i = 0; i < host[0].h_length; i++) {
    24     sprintf (tmpline, "%u", (0xff & host[0].h_addr[i]));
    25     strcat (hostip, tmpline);
    26     if (i < host[0].h_length - 1) strcat (hostip, ".");
    27   }
    28 # endif
    29  
     21  char myHostname[HOST_NAME_MAX];
     22
     23  status = gethostname (myHostname, HOST_NAME_MAX);
     24
     25  fprintf (stderr, "target host: %s, real host: %s\n", hostname, myHostname);
     26
     27  GetPortRange (&start, &stop, portinfo);
     28
     29  fprintf (stderr, "using port range %d - %d\n", start, stop);
     30
    3031  Address[0].sin_family = AF_INET;
    31   Address[0].sin_port   = MY_PORT;
     32  Address[0].sin_port   = start;
    3233  Address[0].sin_addr.s_addr = INADDR_ANY; // use this line to bind any address / port?
    3334
    3435retry_server:
    35 
    36 # if (0) 
    37   status = inet_aton (hostip, &Address[0].sin_addr);
    38   if (!status) {
    39     gprint (GP_ERR, "invalid address\n");
    40     exit (4);
    41   }
    42 # endif
    4336
    4437  length = sizeof(Address[0]);
     
    7467    if (errno == EADDRINUSE) {
    7568        Address[0].sin_port ++;
    76         if (Address[0].sin_port > MY_PORT + 10) {
     69        if (Address[0].sin_port > stop) {
    7770          fprintf (stderr, "failed to find a usable port\n");
    7871          exit (6);
     
    154147}
    155148
    156 int GetClientSocket (char *hostname) {
    157 
    158   int i, status, InitSocket, length;
     149int GetPortRange (int *start, int *stop, char *portinfo) {
     150
     151  // portinfo is a port or port range of the form NN or NN:MM
     152  *start = MY_PORT;
     153  *stop = *start + 10;
     154  if (!portinfo) return TRUE;
     155  if (*portinfo == 0) return TRUE;
     156
     157  char *endptr;
     158  *start = strtol (portinfo, &endptr, 0);
     159  *stop = *start + 10; // default range of 10
     160  if (!endptr) {
     161    gprint (GP_ERR, "error in port range parsing : %s\n", portinfo);
     162    exit (20);
     163  }
     164  if (endptr == portinfo) {
     165    gprint (GP_ERR, "error in port range (%s), must be in form NN:MM or NN\n", portinfo);
     166    exit (20);
     167  }
     168  if (*endptr == 0) return TRUE;
     169
     170  if (*endptr != ':') {
     171    gprint (GP_ERR, "error in port range %s (wrong range separator, must be in form NN:MM)\n", portinfo);
     172    exit (20);
     173  }
     174  char *ptr = endptr + 1;
     175  *stop = strtol (ptr, &endptr, 0);
     176  if (endptr == ptr)  {
     177    gprint (GP_ERR, "error in port range (%s), must be in form NN:MM or NN\n", portinfo);
     178    exit (20);
     179  }
     180  if (*stop - *start > 20) {
     181    gprint (GP_ERR, "error in port range (%s), range must be 20 or less\n", portinfo);
     182    exit (20);
     183  }
     184  if (*stop < *start) {
     185    gprint (GP_ERR, "error in port range (%s), stop must >= start\n", portinfo);
     186    exit (20);
     187  }
     188  return TRUE;
     189}
     190
     191int GetClientSocket (char *hostname, char *portinfo) {
     192
     193  int i, status, InitSocket, length, start, stop;
    159194  SockAddress Address;
    160195  struct hostent  *host;
     
    169204  }
    170205
     206  GetPortRange (&start, &stop, portinfo);
     207
    171208  if (DEBUG) {
    172     gprint (GP_ERR, "trying %s (%s:%d)...", host[0].h_name, hostip, MY_PORT);
     209    gprint (GP_ERR, "trying %s (%s:%d)...", host[0].h_name, hostip, start);
    173210  }
    174211
    175212  Address.sin_family = AF_INET;
    176   Address.sin_port   = MY_PORT;
     213  Address.sin_port   = start;
    177214
    178215retry_client:
     
    195232    if (errno == ECONNREFUSED) {
    196233      Address.sin_port ++;
    197       if (Address.sin_port > MY_PORT + 10) exit (12);
     234      if (Address.sin_port > stop) exit (12);
    198235      goto retry_client;
    199236    }
  • trunk/Ohana/src/opihi/lib.shell/multicommand.c

    r27435 r32632  
    1313void multicommand_InitServer () {
    1414
    15   char hostname[256], PASSWORD[256];
     15  char hostname[256], PASSWORD[256], portinfo[256];
    1616
    1717  if (server != 0) {
     
    2727  }
    2828
     29  /* is a port range defined? otherwise use the default */
     30  memset (portinfo, 0, 256);
     31  VarConfig ("PANTASKS_SERVER_PORT", "%s", portinfo);
     32
    2933  /* attempt to connect to the server */
    30   server = GetClientSocket (hostname);
     34  server = GetClientSocket (hostname, portinfo);
    3135
    3236  /* here we can perform the security handshaking */
  • trunk/Ohana/src/opihi/pantasks/ControllerOps.c

    r27491 r32632  
    258258      sprintf (cmd, "job -host %s", job[0].task[0].host);
    259259    }
     260  }
     261 
     262  if (job[0].priority) {
     263    char tmp[64];
     264    snprintf (tmp, 64, " -nice %d", job[0].priority);
     265    strcat (cmd, tmp);
    260266  }
    261267
  • trunk/Ohana/src/opihi/pantasks/JobOps.c

    r31666 r32632  
    107107    job[0].mode = JOB_CONTROLLER;
    108108  }
     109  job[0].priority = task[0].priority;
    109110
    110111  /* we need our own copy of task[0].argv argc is the number of valid args, like the usual command line.  we
  • trunk/Ohana/src/opihi/pantasks/LocalJob.c

    r23530 r32632  
    161161  if (VerboseMode()) gprint (GP_ERR, "local job launched\n");
    162162
     163  /* set nice level for the child process -- maybe I should not exit here... */
     164  if (job[0].priority) {
     165      status = setpriority (PRIO_PROCESS, pid, job[0].priority);
     166      if (status == -1) {
     167          gprint (GP_ERR, "error setting priority\n");
     168          perror ("setpriority: ");
     169          exit (2);
     170      }
     171  }
     172
    163173  /* close the other ends of the pipes */
    164174  close (stdout_fd[1]); stdout_fd[1] = 0;
  • trunk/Ohana/src/opihi/pantasks/Makefile

    r27995 r32632  
    8383$(SRC)/task.$(ARCH).o \
    8484$(SRC)/task_host.$(ARCH).o \
     85$(SRC)/task_nice.$(ARCH).o \
    8586$(SRC)/task_nmax.$(ARCH).o \
    8687$(SRC)/task_active.$(ARCH).o \
  • trunk/Ohana/src/opihi/pantasks/TaskOps.c

    r31856 r32632  
    487487
    488488  NewTask[0].active = TRUE;
     489  NewTask[0].priority = 0;
    489490  return (NewTask);
    490491}
     
    595596  if (!strcasecmp (command, "END"))       hash = TASK_END;
    596597  if (!strcasecmp (command, "HOST"))      hash = TASK_HOST;
     598  if (!strcasecmp (command, "NICE"))      hash = TASK_NICE;
    597599  if (!strcasecmp (command, "NMAX"))      hash = TASK_NMAX;
    598600  if (!strcasecmp (command, "ACTIVE"))    hash = TASK_ACTIVE;
  • trunk/Ohana/src/opihi/pantasks/init.c

    r23530 r32632  
    44int task            PROTO((int, char **));
    55int task_host       PROTO((int, char **));
     6int task_nice       PROTO((int, char **));
    67int task_nmax       PROTO((int, char **));
    78int task_npending   PROTO((int, char **));
     
    3334  {1, "halt",       halt,          "halt the scheduler (no job harvesting)"},
    3435  {1, "host",       task_host,     "define host machine for a task"},
     36  {1, "nice",       task_nice,     "set nice priority level for a task"},
    3537  {1, "ipptool2book", ipptool2book, "convert queue with ipptool output to book"},
    3638  {1, "kill",       kill_job,      "kill job"},
  • trunk/Ohana/src/opihi/pantasks/init_server.c

    r23530 r32632  
    44int task            PROTO((int, char **));
    55int task_host       PROTO((int, char **));
     6int task_nice       PROTO((int, char **));
    67int task_nmax       PROTO((int, char **));
    78int task_npending   PROTO((int, char **));
     
    3435  {1, "delete",     delete_job,    "delete job"},
    3536  {1, "host",       task_host,     "define host machine for a task"},
     37  {1, "nice",       task_nice,     "set nice priority level for a task"},
    3638  {1, "ipptool2book", ipptool2book, "convert queue with ipptool output to book"},
    3739  {1, "kill",       kill_job,      "kill job"},
  • trunk/Ohana/src/opihi/pantasks/pantasks_server.c.in

    r27999 r32632  
    1818int main (int argc, char **argv) {
    1919 
     20  char hostname[256], portinfo[256];
    2021  char log_stdout[1024], log_stderr[1024];
    2122  pthread_t JobsAndTasksThread;
     
    100101     pass them to the ListenClient thread */
    101102
     103  /* find the defined server hostname */
     104  if (VarConfig ("PANTASKS_SERVER", "%s", hostname) == NULL) {
     105    gprint (GP_ERR, "pantasks server host undefined\n");
     106    exit (31);
     107  }
     108
     109  /* is a port range defined? otherwise use the default */
     110  memset (portinfo, 0, 256);
     111  VarConfig ("PANTASKS_SERVER_PORT", "%s", portinfo);
     112
    102113  /* create the listening socket */
    103   InitSocket = InitServerSocket (&Address);
     114  InitSocket = InitServerSocket (&Address, hostname, portinfo);
    104115 
    105116  InitPassword ();
  • trunk/Ohana/src/opihi/pantasks/task.c

    r31666 r32632  
    7272      case TASK_NMAX:
    7373      case TASK_HOST:
     74      case TASK_NICE:
    7475      case TASK_EXIT:
    7576      case TASK_EXEC:
  • trunk/Ohana/src/opihi/pclient/job.c

    r20047 r32632  
    33int job (int argc, char **argv) {
    44
    5   int i, pid, status;
     5  int i, N, pid, status, priority;
    66  char **targv;
     7
     8  priority = 0;
     9  if ((N = get_argument (argc, argv, "-nice"))) {
     10    remove_argument (N, &argc, argv);
     11    priority = atoi (argv[N]);
     12    remove_argument (N, &argc, argv);
     13  }
    714
    815  if (argc < 2) {
     
    5461  }
    5562
     63  /* set nice level for the child process */
     64  if (priority) {
     65      status = setpriority (PRIO_PROCESS, pid, priority);
     66      if (status == -1) {
     67          gprint (GP_ERR, "error setting priority\n");
     68          perror ("setpriority: ");
     69          exit (2);
     70      }
     71  }
     72
    5673  /* free temporary arg list */
    5774  for (i = 0; i < argc - 1; i++) {
  • trunk/Ohana/src/opihi/pcontrol/CheckIdleHost.c

    r29540 r32632  
    55// a (temporary?) work-around for the problem that the remote pclient job tends to grow
    66// too large over time.
     7
     8/****
     9     
     10     queueing strategy:
     11
     12     We have a problem when the queue contains many jobs of different processing times.  If we
     13     start with an equal number of jobs in two classes, fast and slow, eventually, we will end
     14     up with all hosts running the slow jobs and the fast jobs completely blocked.  If J1 takes
     15     T1 and J2 takes T2, and jobs have equal probability to land in a slot... ??
     16
     17     It seems like we should boost the probability of the fast jobs over the slow jobs (of
     18     course, the end result of that will be all fast jobs draining and the slow jobs hanging
     19     around). 
     20
     21     There is also a problem related to LAP, in that chip stage has a huge number of tasks in
     22     the queue (effectively infinite).  Make the probability of the job being selected
     23     proportional to something.  In any case, we need a user-controllable way to change the
     24     probability of selection
     25
     26     As things are implemented below, the selection order depends on the queue order.  The
     27     easiest way to modify the probabilities is to re-sort based on something.
     28
     29 ****/
    730
    831static float MAX_WANTHOST_WAIT = 10.0;
  • trunk/Ohana/src/opihi/pcontrol/JobOps.c

    r29540 r32632  
    195195}
    196196
    197 IDtype AddJob (char *hostname, JobMode mode, int timeout, int argc, char **argv, int Nxhosts, char **xhosts) {
     197IDtype AddJob (char *hostname, JobMode mode, int timeout, int priority, int argc, char **argv, int Nxhosts, char **xhosts) {
    198198
    199199  int JobID;
     
    220220
    221221  job[0].mode     = mode;
     222  job[0].priority = priority;
    222223
    223224  job[0].state = 0;
     
    270271  FREE (job);
    271272}
     273
     274/*** ResortJobStack can be used to adjust priorities based on some info we supply.  This
     275     is not finished -- to finish this, I need to define the metric of interest and
     276     arrange for that to be passed to the jobs in pcontrol
     277
     278void ResortJobStack (int StackID) {
     279
     280  Stack *stack = GetJobStack (StackID);
     281  LockStack (stack);
     282
     283# define SWAPFUNC(A,B){                         \
     284    void *tmpObject = stack[0].object[A];       \
     285    stack[0].object[A] = stack[0].object[B];    \
     286    stack[0].object[B] = tmpObject;             \
     287    void *tmpName = stack[0].name[A];           \
     288    stack[0].name[A] = stack[0].name[B];        \
     289    stack[0].name[B] = tmpName;                 \
     290    void *tmpID = stack[0].id[A];               \
     291    stack[0].id[A] = stack[0].id[B];            \
     292    stack[0].id[B] = tmpID;                     \
     293  }
     294
     295# define COMPARE(A,B)(((Job *)stack[0].object[A]).VALUE < ((Job *)stack[0].object[B]).VALUE)
     296
     297  OHANA_SORT (stack[0].Nobject, COMPARE, SWAPFUNC);
     298
     299# undef SWAPFUNC
     300# undef COMPARE
     301
     302  UnlockStack (stack);
     303}
     304
     305***/
  • trunk/Ohana/src/opihi/pcontrol/StartJob.c

    r28317 r32632  
    2525  bzero (line, Nline);
    2626  strcpy (line, "job");
     27  if (job[0].priority) {
     28    char tmp[64];
     29    snprintf (tmp, 64, " -nice %d", job[0].priority);
     30    strcat (line, tmp);
     31  }
    2732  for (i = 0; i < job[0].argc; i++) {
    2833    strcat (line, " ");
  • trunk/Ohana/src/opihi/pcontrol/job.c

    r29558 r32632  
    55  char *Host = NULL;
    66  char **targv = NULL;
    7   int i, N, Mode, targc, Timeout;
     7  int i, N, Mode, targc, Timeout, priority;
    88  IDtype JobID;
    99  char **xhosts = NULL;
     
    4343  }
    4444
     45  priority = 0;
     46  if ((N = get_argument (argc, argv, "-nice"))) {
     47    remove_argument (N, &argc, argv);
     48    priority = atoi (argv[N]);
     49    remove_argument (N, &argc, argv);
     50  }
     51
    4552  xhosts = NULL;
    4653  Nxhosts = 0;
     
    6067  }
    6168
    62   if (argc < 2) {
    63     FREE (Host);
    64     goto usage;
    65   }
     69  if (argc < 2) goto usage;
    6670 
    6771  targc = argc - 1;
     
    7276
    7377  // a JobID < 0 mean the job was not accepted
    74   JobID = AddJob (Host, Mode, Timeout, targc, targv, Nxhosts, xhosts);
     78  JobID = AddJob (Host, Mode, Timeout, priority, targc, targv, Nxhosts, xhosts);
    7579  gprint (GP_LOG, "JobID: %d\n", (int) JobID);
    7680  return (TRUE);
  • trunk/Ohana/src/opihi/pcontrol/status.c

    r21379 r32632  
    5959    }
    6060
     61    PrintID (GP_LOG, job[0].JobID);
     62    gprint (GP_LOG, " %2d ", job[0].priority);
    6163    for (j = 0; j < job[0].argc; j++) {
    6264      gprint (GP_LOG, "%s ", job[0].argv[j]);
    6365    }
    64     PrintID (GP_LOG, job[0].JobID);
    6566    gprint (GP_LOG, "\n");
    6667  }
Note: See TracChangeset for help on using the changeset viewer.