Changeset 4602 for trunk/Ohana/src/opihi/pantasks
- Timestamp:
- Jul 23, 2005, 9:13:00 PM (21 years ago)
- Location:
- trunk/Ohana/src/opihi/pantasks
- Files:
-
- 3 added
- 9 edited
-
CheckJobs.c (modified) (5 diffs)
-
CheckTasks.c (modified) (2 diffs)
-
CheckTimeRanges.c (added)
-
ControllerOps.c (modified) (1 diff)
-
LocalJob.c (modified) (1 diff)
-
Makefile (modified) (3 diffs)
-
TaskOps.c (modified) (2 diffs)
-
init.c (modified) (4 diffs)
-
status.c (modified) (1 diff)
-
task.c (modified) (3 diffs)
-
task_trange.c (added)
-
verbose.c (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/pantasks/CheckJobs.c
r4452 r4602 14 14 /* check for timeout - only local jobs timeout here */ 15 15 if ((job[0].mode == JOB_LOCAL) && (GetTaskTimer(job[0].start) >= job[0].task[0].timeout_period)) { 16 fprintf (stderr, "timeout on %s\n", job[0].task[0].name);16 if (VerboseMode()) fprintf (stderr, "timeout on %s\n", job[0].task[0].name); 17 17 /* run task[0].timeout macro, if it exists */ 18 18 if (job[0].task[0].timeout != NULL) { … … 30 30 switch (status) { 31 31 case JOB_PENDING: 32 fprintf (stderr, "job %s (%d) pending\n", job[0].task[0].name, job[0].JobID);32 if (VerboseMode()) fprintf (stderr, "job %s (%d) pending\n", job[0].task[0].name, job[0].JobID); 33 33 break; 34 34 35 35 case JOB_BUSY: 36 fprintf (stderr, "job %s (%d) busy\n", job[0].task[0].name, job[0].JobID);36 if (VerboseMode()) fprintf (stderr, "job %s (%d) busy\n", job[0].task[0].name, job[0].JobID); 37 37 break; 38 38 … … 41 41 /* set the stdout and stderr variables with job.stdout, job.stderr */ 42 42 /* XXX this will break on 0 values in output streams */ 43 fprintf (stderr, "job %s (%d) crash\n", job[0].task[0].name, job[0].JobID);43 if (VerboseMode()) fprintf (stderr, "job %s (%d) crash\n", job[0].task[0].name, job[0].JobID); 44 44 set_str_variable ("stdout", job[0].stdout.buffer); 45 45 set_str_variable ("stderr", job[0].stderr.buffer); … … 52 52 53 53 case JOB_EXIT: 54 fprintf (stderr, "job %s (%d) exit\n", job[0].task[0].name, job[0].JobID);54 if (VerboseMode()) fprintf (stderr, "job %s (%d) exit\n", job[0].task[0].name, job[0].JobID); 55 55 set_str_variable ("stdout", job[0].stdout.buffer); 56 56 set_str_variable ("stderr", job[0].stderr.buffer); … … 69 69 70 70 default: 71 fprintf (stderr, "unknown exit status: %d\n", status);71 if (VerboseMode()) fprintf (stderr, "unknown exit status: %d\n", status); 72 72 /** do something more useful here ?? **/ 73 73 break; -
trunk/Ohana/src/opihi/pantasks/CheckTasks.c
r4450 r4602 15 15 if (GetTaskTimer(task[0].last) < task[0].exec_period) continue; 16 16 17 /* need to check if the current time is within valid/invalid periods */ 18 if (!CheckTimeRanges (task[0].ranges, task[0].Nranges)) continue; 19 17 20 SetCurrentTask (task[0].name); 18 fprintf (stderr, "trying task %s\n", task[0].name);19 21 20 22 /* ready to run? : run task.exec macro */ … … 35 37 /* reset timer on task (don't do this if Create/Submit fails)*/ 36 38 gettimeofday (&task[0].last, (void *) NULL); 39 task[0].Njobs ++; 37 40 } 38 41 return (TRUE); -
trunk/Ohana/src/opihi/pantasks/ControllerOps.c
r4573 r4602 339 339 int Nread; 340 340 341 if (!status) return (TRUE); 342 341 343 /* read stdout buffer */ 342 344 Nread = ReadtoIOBuffer (&stdout_buffer, stdout_cntl); -
trunk/Ohana/src/opihi/pantasks/LocalJob.c
r4451 r4602 15 15 pid = fork (); 16 16 if (!pid) { /* must be child process */ 17 fprintf (stderr, "starting local job\n");17 if (VerboseMode()) fprintf (stderr, "starting local job\n"); 18 18 19 19 /* close the other ends of the pipes */ -
trunk/Ohana/src/opihi/pantasks/Makefile
r4573 r4602 31 31 $(SDIR)/CheckSystem.$(ARCH).o \ 32 32 $(SDIR)/CheckTasks.$(ARCH).o \ 33 $(SDIR)/CheckTimeRanges.$(ARCH).o \ 33 34 $(SDIR)/ControllerOps.$(ARCH).o \ 34 35 $(SDIR)/LocalJob.$(ARCH).o \ … … 44 45 $(SDIR)/kill.$(ARCH).o \ 45 46 $(SDIR)/delete.$(ARCH).o \ 47 $(SDIR)/verbose.$(ARCH).o \ 46 48 $(SDIR)/controller.$(ARCH).o \ 47 49 $(SDIR)/controller_host.$(ARCH).o \ … … 53 55 $(SDIR)/task_host.$(ARCH).o \ 54 56 $(SDIR)/task_macros.$(ARCH).o \ 57 $(SDIR)/task_trange.$(ARCH).o \ 55 58 $(SDIR)/task_periods.$(ARCH).o 56 59 -
trunk/Ohana/src/opihi/pantasks/TaskOps.c
r4450 r4602 37 37 void ListTasks () { 38 38 39 int i ;39 int i, valid; 40 40 41 41 for (i = 0; i < Ntasks; i++) { 42 fprintf (stderr, "%-15s %20s\n", tasks[i].name, tasks[i].argv[0]); 42 valid = CheckTimeRanges (tasks[i].ranges, tasks[i].Nranges); 43 if (valid) { 44 fprintf (stderr, "+ "); 45 } else { 46 fprintf (stderr, "- "); 47 } 48 fprintf (stderr, "%-15s %4d %20s\n", tasks[i].name, tasks[i].Njobs, tasks[i].argv[0]); 43 49 } 44 50 return; … … 126 132 tasks[Ntasks].timeout_period = 1.0; 127 133 134 tasks[Ntasks].Nranges = 0; 135 ALLOCATE (tasks[Ntasks].ranges, TimeRange, 1); 136 128 137 /* init task timer (is reset by 'run') */ 129 138 gettimeofday (&tasks[Ntasks].last, (void *) NULL); 139 tasks[Ntasks].Njobs = 0; 130 140 131 141 Ntasks ++; -
trunk/Ohana/src/opihi/pantasks/init.c
r4552 r4602 4 4 int task PROTO((int, char **)); 5 5 int task_host PROTO((int, char **)); 6 int task_trange PROTO((int, char **)); 6 7 int task_macros PROTO((int, char **)); 7 8 int task_command PROTO((int, char **)); … … 12 13 int kill_job PROTO((int, char **)); 13 14 int delete_job PROTO((int, char **)); 15 int verbose PROTO((int, char **)); 14 16 15 17 static Command cmds[] = { … … 17 19 {"task", task, "define a schedulable task"}, 18 20 {"host", task_host, "define host machine for a task"}, 21 {"trange", task_trange, "define valid/invalid time periods for a task"}, 19 22 {"task.exit", task_macros, "define exit macros for a task"}, 20 23 {"task.exec", task_macros, "define pre-exec macro for a task"}, … … 26 29 {"kill", kill_job, "kill job"}, 27 30 {"delete", delete_job, "delete job"}, 31 {"verbose", verbose, "set/toggle verbose mode"}, 28 32 }; 29 33 -
trunk/Ohana/src/opihi/pantasks/status.c
r4552 r4602 3 3 int status_sys (int argc, char **argv) { 4 4 5 if (rl_event_hook == NULL) { 6 fprintf (stderr, "scheduler is stopped\n"); 7 } else { 8 fprintf (stderr, "scheduler is running\n"); 9 } 5 10 ListTasks (); 6 11 ListJobs (); -
trunk/Ohana/src/opihi/pantasks/task.c
r4451 r4602 2 2 # define prompt "> " 3 3 4 enum {TASK_NONE, TASK_EMPTY, TASK_COMMENT, TASK_ END, TASK_HOST, TASK_COMMAND, TASK_PERIODS, TASK_EXIT, TASK_EXEC};4 enum {TASK_NONE, TASK_EMPTY, TASK_COMMENT, TASK_NMAX, TASK_TRANGE, TASK_END, TASK_HOST, TASK_COMMAND, TASK_PERIODS, TASK_EXIT, TASK_EXEC}; 5 5 6 6 int task (int argc, char **argv) { … … 68 68 69 69 case TASK_END: 70 /* I need to add in a test here to see if all task elements 71 have been defined. delete the task if not */ 70 72 free (input); 71 73 return (TRUE); 72 74 break; 73 75 76 case TASK_TRANGE: 77 case TASK_NMAX: 74 78 case TASK_HOST: 75 79 case TASK_EXIT: … … 104 108 if (!strcasecmp (command, "END")) hash = TASK_END; 105 109 if (!strcasecmp (command, "HOST")) hash = TASK_HOST; 110 if (!strcasecmp (command, "NMAX")) hash = TASK_NMAX; 111 if (!strcasecmp (command, "TRANGE")) hash = TASK_TRANGE; 106 112 if (!strcasecmp (command, "COMMAND")) hash = TASK_COMMAND; 107 113 if (!strcasecmp (command, "PERIODS")) hash = TASK_PERIODS;
Note:
See TracChangeset
for help on using the changeset viewer.
