Changeset 32632
- Timestamp:
- Nov 8, 2011, 2:54:20 PM (15 years ago)
- Location:
- trunk/Ohana/src
- Files:
-
- 30 edited
- 5 copied
-
addstar/src/find_matches_closest.c (modified) (1 diff)
-
kapa2/src/DrawFrame.c (modified) (1 diff)
-
libdvo/src/dvo_set_catdir.c (modified) (1 diff)
-
libohana/include/ohana.h (modified) (1 diff)
-
libohana/src/ohana_allocate.c (modified) (1 diff)
-
opihi/cmd.astro/Makefile (modified) (1 diff)
-
opihi/cmd.astro/init.c (modified) (2 diffs)
-
opihi/cmd.astro/ringflux.c (copied) (copied from branches/eam_branches/ipp-20110906/Ohana/src/opihi/cmd.astro/ringflux.c )
-
opihi/cmd.data/read_vectors.c (modified) (5 diffs)
-
opihi/cmd.data/vstats.c (modified) (2 diffs)
-
opihi/dvo/skycoverage.c (modified) (1 diff)
-
opihi/include/pantasks.h (modified) (3 diffs)
-
opihi/include/pcontrol.h (modified) (4 diffs)
-
opihi/include/shell.h (modified) (1 diff)
-
opihi/lib.shell/SocketOps.c (modified) (6 diffs)
-
opihi/lib.shell/multicommand.c (modified) (2 diffs)
-
opihi/pantasks/ControllerOps.c (modified) (1 diff)
-
opihi/pantasks/JobOps.c (modified) (1 diff)
-
opihi/pantasks/LocalJob.c (modified) (1 diff)
-
opihi/pantasks/Makefile (modified) (1 diff)
-
opihi/pantasks/TaskOps.c (modified) (2 diffs)
-
opihi/pantasks/init.c (modified) (2 diffs)
-
opihi/pantasks/init_server.c (modified) (2 diffs)
-
opihi/pantasks/pantasks_server.c.in (modified) (2 diffs)
-
opihi/pantasks/task.c (modified) (1 diff)
-
opihi/pantasks/task_nice.c (copied) (copied from branches/eam_branches/ipp-20110906/Ohana/src/opihi/pantasks/task_nice.c )
-
opihi/pantasks/test/nice.sh (copied) (copied from branches/eam_branches/ipp-20110906/Ohana/src/opihi/pantasks/test/nice.sh )
-
opihi/pantasks/test/nice_remote.sh (copied) (copied from branches/eam_branches/ipp-20110906/Ohana/src/opihi/pantasks/test/nice_remote.sh )
-
opihi/pclient/job.c (modified) (2 diffs)
-
opihi/pcontrol/CheckIdleHost.c (modified) (1 diff)
-
opihi/pcontrol/JobOps.c (modified) (3 diffs)
-
opihi/pcontrol/StackOpsLL.c (copied) (copied from branches/eam_branches/ipp-20110906/Ohana/src/opihi/pcontrol/StackOpsLL.c )
-
opihi/pcontrol/StartJob.c (modified) (1 diff)
-
opihi/pcontrol/job.c (modified) (4 diffs)
-
opihi/pcontrol/status.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/addstar/src/find_matches_closest.c
r28840 r32632 132 132 } 133 133 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 134 141 /* within match range; look for matches */ 135 142 Jmin = -1; -
trunk/Ohana/src/kapa2/src/DrawFrame.c
r29955 r32632 150 150 } 151 151 152 # define MIN_RANGE 1e-10 152 // do I really want this? allow an override? 153 # define MIN_RANGE 1e-30 153 154 154 155 void AxisTickScale (Axis *axis, double *major, double *minor, int *nsignif) { -
trunk/Ohana/src/libdvo/src/dvo_set_catdir.c
r31635 r32632 15 15 } 16 16 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); 18 19 } 19 20 } -
trunk/Ohana/src/libohana/include/ohana.h
r31663 r32632 20 20 21 21 // comment this out to avoid the internal Ohana memory management code 22 //# define OHANA_MEMORY22 # define OHANA_MEMORY 23 23 24 24 // XXX I was including these before, but RHL claims they are not needed -
trunk/Ohana/src/libohana/src/ohana_allocate.c
r31663 r32632 112 112 // memblock of supplied pointer 113 113 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); 114 117 115 118 Nelem = MAX (1, Nelem); -
trunk/Ohana/src/opihi/cmd.astro/Makefile
r31635 r32632 43 43 $(SRC)/galprofiles.$(ARCH).o \ 44 44 $(SRC)/elliprofile.$(ARCH).o \ 45 $(SRC)/ringflux.$(ARCH).o \ 45 46 $(SRC)/petrosian.$(ARCH).o \ 46 47 $(SRC)/multifit.$(ARCH).o \ -
trunk/Ohana/src/opihi/cmd.astro/init.c
r30972 r32632 29 29 int galradbins PROTO((int, char **)); 30 30 int elliprofile PROTO((int, char **)); 31 int ringflux PROTO((int, char **)); 31 32 int petrosian PROTO((int, char **)); 32 33 int mkgauss PROTO((int, char **)); … … 78 79 {1, "galradbins", galradbins, "generate radial vectors with interpolation along paths"}, 79 80 {1, "elliprofile", elliprofile, "generate radial vectors with interpolation along paths"}, 81 {1, "ringflux", ringflux, "mean flux in a ring"}, 80 82 {1, "petrosian", petrosian, "petrosian parameters given radial bins"}, 81 83 {1, "multifit", multifit, "fit multi-order spectrum"}, -
trunk/Ohana/src/opihi/cmd.data/read_vectors.c
r31667 r32632 23 23 int read_vectors (int argc, char **argv) { 24 24 25 int i, j, Nskip, Nvec, *col, done, status, IsCSV;25 int i, j, Nskip, Nvec, *col, done, status, IsCSV, VERBOSE; 26 26 int Nbytes, nbytes, Nstart, NELEM, N, nread; 27 27 char *colstr, *c0, *c1, *buffer, *extname; … … 51 51 remove_argument (N, &argc, argv); 52 52 IsCSV = TRUE; 53 } 54 55 VERBOSE = FALSE; 56 if ((N = get_argument (argc, argv, "-v"))) { 57 remove_argument (N, &argc, argv); 58 VERBOSE = TRUE; 53 59 } 54 60 … … 121 127 scan_line (f, buffer); 122 128 } 123 124 int Nfield = 0;125 int Nline = 0;126 129 127 130 Nstart = 0; … … 157 160 status = dparse (&value, col[i], c0); 158 161 } 159 vec[i][0].elements.Flt[N] = value;160 162 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 } 162 173 } 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 } 172 186 c0 = c1 + 1; 173 187 if (N == NELEM) { … … 177 191 } 178 192 } 179 180 193 } 181 194 } -
trunk/Ohana/src/opihi/cmd.data/vstats.c
r30610 r32632 169 169 170 170 // we are going to do another pass: mark the entries to skip 171 pmin = m ax;172 pmax = m in;171 pmin = min; 172 pmax = max; 173 173 if (iter < Niter - 1) { 174 174 if (vec[0].type == OPIHI_FLT) { … … 208 208 skip: 209 209 FREE(mask); 210 if (mask) mask = NULL; 210 211 211 212 if (!Quiet) { -
trunk/Ohana/src/opihi/dvo/skycoverage.c
r31635 r32632 202 202 V[ys*Nx + xs] = ShowDensity ? 0 : 2; 203 203 } else { 204 V[ys*Nx + xs] = ShowDensity ? -1: 0;204 V[ys*Nx + xs] = ShowDensity ? NAN : 0; 205 205 } 206 206 } -
trunk/Ohana/src/opihi/include/pantasks.h
r31667 r32632 40 40 TASK_END, 41 41 TASK_HOST, 42 TASK_NICE, 42 43 TASK_STDOUT, 43 44 TASK_STDERR, … … 115 116 116 117 int active; 118 int priority; 117 119 118 120 } Task; … … 159 161 160 162 JobMode mode; /* local or controller? */ 163 int priority; 161 164 char *realhost; 162 165 -
trunk/Ohana/src/opihi/include/pcontrol.h
r29540 r32632 119 119 int exit_status; 120 120 int Reset; 121 int priority; 121 122 JobMode mode; 122 123 JobStat state; … … 152 153 } Host; 153 154 155 # if (USE_LLIST) 156 typedef 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 */ 165 typedef 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 154 176 /* the Jobs and Hosts are managed in a set of Stacks which define their state */ 155 177 typedef struct { … … 163 185 # endif 164 186 } Stack; 187 # endif 165 188 166 189 /* XXX if this is hard-wired, we can't change shell name in StartHost */ … … 291 314 Job *PullJobByID (IDtype JobID, int *StackID); 292 315 Job *PullJobFromStackByID (int StackID, int ID); 293 IDtype AddJob (char *hostname, JobMode mode, int timeout, int argc, char **argv, int Nxhosts, char **xhosts);316 IDtype AddJob (char *hostname, JobMode mode, int timeout, int priority, int argc, char **argv, int Nxhosts, char **xhosts); 294 317 void DelJob (Job *job); 295 318 Host *UnlinkJobAndHost (Job *job); -
trunk/Ohana/src/opihi/include/shell.h
r31667 r32632 184 184 185 185 /* socket functions */ 186 int InitServerSocket (SockAddress *Address );186 int InitServerSocket (SockAddress *Address, char *hostname, char *portinfo); 187 187 int WaitServerSocket (int InitSocket, SockAddress *Address); 188 int GetClientSocket (char *hostname );188 int GetClientSocket (char *hostname, char *portinfo); 189 189 int InitServerSocket_Named (char *hostname, SockAddress *Address); 190 190 int DefineValidIP (void); -
trunk/Ohana/src/opihi/lib.shell/SocketOps.c
r23530 r32632 1 1 # include "shell.h" 2 # include <unistd.h> 3 # define HOST_NAME_MAX 256 2 4 3 5 # define MY_PORT 2000 … … 11 13 static int *VALID; 12 14 13 int InitServerSocket (SockAddress *Address) { 14 15 int GetPortRange (int *start, int *stop, char *portinfo); 16 17 int InitServerSocket (SockAddress *Address, char *hostname, char *portinfo) { 18 19 int start, stop; 15 20 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 30 31 Address[0].sin_family = AF_INET; 31 Address[0].sin_port = MY_PORT;32 Address[0].sin_port = start; 32 33 Address[0].sin_addr.s_addr = INADDR_ANY; // use this line to bind any address / port? 33 34 34 35 retry_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 # endif43 36 44 37 length = sizeof(Address[0]); … … 74 67 if (errno == EADDRINUSE) { 75 68 Address[0].sin_port ++; 76 if (Address[0].sin_port > MY_PORT + 10) {69 if (Address[0].sin_port > stop) { 77 70 fprintf (stderr, "failed to find a usable port\n"); 78 71 exit (6); … … 154 147 } 155 148 156 int GetClientSocket (char *hostname) { 157 158 int i, status, InitSocket, length; 149 int 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 191 int GetClientSocket (char *hostname, char *portinfo) { 192 193 int i, status, InitSocket, length, start, stop; 159 194 SockAddress Address; 160 195 struct hostent *host; … … 169 204 } 170 205 206 GetPortRange (&start, &stop, portinfo); 207 171 208 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); 173 210 } 174 211 175 212 Address.sin_family = AF_INET; 176 Address.sin_port = MY_PORT;213 Address.sin_port = start; 177 214 178 215 retry_client: … … 195 232 if (errno == ECONNREFUSED) { 196 233 Address.sin_port ++; 197 if (Address.sin_port > MY_PORT + 10) exit (12);234 if (Address.sin_port > stop) exit (12); 198 235 goto retry_client; 199 236 } -
trunk/Ohana/src/opihi/lib.shell/multicommand.c
r27435 r32632 13 13 void multicommand_InitServer () { 14 14 15 char hostname[256], PASSWORD[256] ;15 char hostname[256], PASSWORD[256], portinfo[256]; 16 16 17 17 if (server != 0) { … … 27 27 } 28 28 29 /* is a port range defined? otherwise use the default */ 30 memset (portinfo, 0, 256); 31 VarConfig ("PANTASKS_SERVER_PORT", "%s", portinfo); 32 29 33 /* attempt to connect to the server */ 30 server = GetClientSocket (hostname );34 server = GetClientSocket (hostname, portinfo); 31 35 32 36 /* here we can perform the security handshaking */ -
trunk/Ohana/src/opihi/pantasks/ControllerOps.c
r27491 r32632 258 258 sprintf (cmd, "job -host %s", job[0].task[0].host); 259 259 } 260 } 261 262 if (job[0].priority) { 263 char tmp[64]; 264 snprintf (tmp, 64, " -nice %d", job[0].priority); 265 strcat (cmd, tmp); 260 266 } 261 267 -
trunk/Ohana/src/opihi/pantasks/JobOps.c
r31666 r32632 107 107 job[0].mode = JOB_CONTROLLER; 108 108 } 109 job[0].priority = task[0].priority; 109 110 110 111 /* 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 161 161 if (VerboseMode()) gprint (GP_ERR, "local job launched\n"); 162 162 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 163 173 /* close the other ends of the pipes */ 164 174 close (stdout_fd[1]); stdout_fd[1] = 0; -
trunk/Ohana/src/opihi/pantasks/Makefile
r27995 r32632 83 83 $(SRC)/task.$(ARCH).o \ 84 84 $(SRC)/task_host.$(ARCH).o \ 85 $(SRC)/task_nice.$(ARCH).o \ 85 86 $(SRC)/task_nmax.$(ARCH).o \ 86 87 $(SRC)/task_active.$(ARCH).o \ -
trunk/Ohana/src/opihi/pantasks/TaskOps.c
r31856 r32632 487 487 488 488 NewTask[0].active = TRUE; 489 NewTask[0].priority = 0; 489 490 return (NewTask); 490 491 } … … 595 596 if (!strcasecmp (command, "END")) hash = TASK_END; 596 597 if (!strcasecmp (command, "HOST")) hash = TASK_HOST; 598 if (!strcasecmp (command, "NICE")) hash = TASK_NICE; 597 599 if (!strcasecmp (command, "NMAX")) hash = TASK_NMAX; 598 600 if (!strcasecmp (command, "ACTIVE")) hash = TASK_ACTIVE; -
trunk/Ohana/src/opihi/pantasks/init.c
r23530 r32632 4 4 int task PROTO((int, char **)); 5 5 int task_host PROTO((int, char **)); 6 int task_nice PROTO((int, char **)); 6 7 int task_nmax PROTO((int, char **)); 7 8 int task_npending PROTO((int, char **)); … … 33 34 {1, "halt", halt, "halt the scheduler (no job harvesting)"}, 34 35 {1, "host", task_host, "define host machine for a task"}, 36 {1, "nice", task_nice, "set nice priority level for a task"}, 35 37 {1, "ipptool2book", ipptool2book, "convert queue with ipptool output to book"}, 36 38 {1, "kill", kill_job, "kill job"}, -
trunk/Ohana/src/opihi/pantasks/init_server.c
r23530 r32632 4 4 int task PROTO((int, char **)); 5 5 int task_host PROTO((int, char **)); 6 int task_nice PROTO((int, char **)); 6 7 int task_nmax PROTO((int, char **)); 7 8 int task_npending PROTO((int, char **)); … … 34 35 {1, "delete", delete_job, "delete job"}, 35 36 {1, "host", task_host, "define host machine for a task"}, 37 {1, "nice", task_nice, "set nice priority level for a task"}, 36 38 {1, "ipptool2book", ipptool2book, "convert queue with ipptool output to book"}, 37 39 {1, "kill", kill_job, "kill job"}, -
trunk/Ohana/src/opihi/pantasks/pantasks_server.c.in
r27999 r32632 18 18 int main (int argc, char **argv) { 19 19 20 char hostname[256], portinfo[256]; 20 21 char log_stdout[1024], log_stderr[1024]; 21 22 pthread_t JobsAndTasksThread; … … 100 101 pass them to the ListenClient thread */ 101 102 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 102 113 /* create the listening socket */ 103 InitSocket = InitServerSocket (&Address );114 InitSocket = InitServerSocket (&Address, hostname, portinfo); 104 115 105 116 InitPassword (); -
trunk/Ohana/src/opihi/pantasks/task.c
r31666 r32632 72 72 case TASK_NMAX: 73 73 case TASK_HOST: 74 case TASK_NICE: 74 75 case TASK_EXIT: 75 76 case TASK_EXEC: -
trunk/Ohana/src/opihi/pclient/job.c
r20047 r32632 3 3 int job (int argc, char **argv) { 4 4 5 int i, pid, status;5 int i, N, pid, status, priority; 6 6 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 } 7 14 8 15 if (argc < 2) { … … 54 61 } 55 62 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 56 73 /* free temporary arg list */ 57 74 for (i = 0; i < argc - 1; i++) { -
trunk/Ohana/src/opihi/pcontrol/CheckIdleHost.c
r29540 r32632 5 5 // a (temporary?) work-around for the problem that the remote pclient job tends to grow 6 6 // 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 ****/ 7 30 8 31 static float MAX_WANTHOST_WAIT = 10.0; -
trunk/Ohana/src/opihi/pcontrol/JobOps.c
r29540 r32632 195 195 } 196 196 197 IDtype AddJob (char *hostname, JobMode mode, int timeout, int argc, char **argv, int Nxhosts, char **xhosts) {197 IDtype AddJob (char *hostname, JobMode mode, int timeout, int priority, int argc, char **argv, int Nxhosts, char **xhosts) { 198 198 199 199 int JobID; … … 220 220 221 221 job[0].mode = mode; 222 job[0].priority = priority; 222 223 223 224 job[0].state = 0; … … 270 271 FREE (job); 271 272 } 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 278 void 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 25 25 bzero (line, Nline); 26 26 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 } 27 32 for (i = 0; i < job[0].argc; i++) { 28 33 strcat (line, " "); -
trunk/Ohana/src/opihi/pcontrol/job.c
r29558 r32632 5 5 char *Host = NULL; 6 6 char **targv = NULL; 7 int i, N, Mode, targc, Timeout ;7 int i, N, Mode, targc, Timeout, priority; 8 8 IDtype JobID; 9 9 char **xhosts = NULL; … … 43 43 } 44 44 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 45 52 xhosts = NULL; 46 53 Nxhosts = 0; … … 60 67 } 61 68 62 if (argc < 2) { 63 FREE (Host); 64 goto usage; 65 } 69 if (argc < 2) goto usage; 66 70 67 71 targc = argc - 1; … … 72 76 73 77 // 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); 75 79 gprint (GP_LOG, "JobID: %d\n", (int) JobID); 76 80 return (TRUE); -
trunk/Ohana/src/opihi/pcontrol/status.c
r21379 r32632 59 59 } 60 60 61 PrintID (GP_LOG, job[0].JobID); 62 gprint (GP_LOG, " %2d ", job[0].priority); 61 63 for (j = 0; j < job[0].argc; j++) { 62 64 gprint (GP_LOG, "%s ", job[0].argv[j]); 63 65 } 64 PrintID (GP_LOG, job[0].JobID);65 66 gprint (GP_LOG, "\n"); 66 67 }
Note:
See TracChangeset
for help on using the changeset viewer.
