Changeset 32584
- Timestamp:
- Oct 28, 2011, 6:38:09 AM (15 years ago)
- Location:
- branches/eam_branches/ipp-20110906/Ohana/src/opihi
- Files:
-
- 1 added
- 10 edited
-
include/pantasks.h (modified) (2 diffs)
-
include/pcontrol.h (modified) (2 diffs)
-
pantasks/ControllerOps.c (modified) (1 diff)
-
pantasks/JobOps.c (modified) (1 diff)
-
pantasks/LocalJob.c (modified) (1 diff)
-
pantasks/TaskOps.c (modified) (1 diff)
-
pantasks/task_nice.c (added)
-
pclient/job.c (modified) (2 diffs)
-
pcontrol/JobOps.c (modified) (2 diffs)
-
pcontrol/StartJob.c (modified) (1 diff)
-
pcontrol/job.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110906/Ohana/src/opihi/include/pantasks.h
r31667 r32584 115 115 116 116 int active; 117 int priority; 117 118 118 119 } Task; … … 159 160 160 161 JobMode mode; /* local or controller? */ 162 int priority; 161 163 char *realhost; 162 164 -
branches/eam_branches/ipp-20110906/Ohana/src/opihi/include/pcontrol.h
r32568 r32584 119 119 int exit_status; 120 120 int Reset; 121 int priority; 121 122 JobMode mode; 122 123 JobStat state; … … 313 314 Job *PullJobByID (IDtype JobID, int *StackID); 314 315 Job *PullJobFromStackByID (int StackID, int ID); 315 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); 316 317 void DelJob (Job *job); 317 318 Host *UnlinkJobAndHost (Job *job); -
branches/eam_branches/ipp-20110906/Ohana/src/opihi/pantasks/ControllerOps.c
r27491 r32584 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 -
branches/eam_branches/ipp-20110906/Ohana/src/opihi/pantasks/JobOps.c
r31666 r32584 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 -
branches/eam_branches/ipp-20110906/Ohana/src/opihi/pantasks/LocalJob.c
r23530 r32584 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; -
branches/eam_branches/ipp-20110906/Ohana/src/opihi/pantasks/TaskOps.c
r31856 r32584 487 487 488 488 NewTask[0].active = TRUE; 489 NewTask[0].priority = 0; 489 490 return (NewTask); 490 491 } -
branches/eam_branches/ipp-20110906/Ohana/src/opihi/pclient/job.c
r20047 r32584 3 3 int job (int argc, char **argv) { 4 4 5 int i, pid, status ;5 int i, 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++) { -
branches/eam_branches/ipp-20110906/Ohana/src/opihi/pcontrol/JobOps.c
r32568 r32584 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; -
branches/eam_branches/ipp-20110906/Ohana/src/opihi/pcontrol/StartJob.c
r28317 r32584 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, " "); -
branches/eam_branches/ipp-20110906/Ohana/src/opihi/pcontrol/job.c
r29558 r32584 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; … … 72 79 73 80 // a JobID < 0 mean the job was not accepted 74 JobID = AddJob (Host, Mode, Timeout, targc, targv, Nxhosts, xhosts);81 JobID = AddJob (Host, Mode, Timeout, priority, targc, targv, Nxhosts, xhosts); 75 82 gprint (GP_LOG, "JobID: %d\n", (int) JobID); 76 83 return (TRUE);
Note:
See TracChangeset
for help on using the changeset viewer.
