IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4693


Ignore:
Timestamp:
Aug 1, 2005, 4:54:17 AM (21 years ago)
Author:
eugene
Message:

moved sched/scheduler to psched

Location:
trunk/Ohana/src/opihi
Files:
6 added
3 deleted
41 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/Makefile

    r4689 r4693  
    1010dvo2:  lib.data lib.shell cmd.basic cmd.data cmd.astro
    1111dvo:   lib.data lib.shell cmd.basic cmd.data cmd.astro
    12 sched: lib.data lib.shell cmd.basic cmd.data cmd.astro
    13 pclient: lib.data lib.shell cmd.basic
     12psched:  lib.data lib.shell cmd.basic cmd.data cmd.astro
     13pclient:  lib.data lib.shell cmd.basic
    1414pcontrol: lib.data lib.shell cmd.basic
    1515
     
    1818PROGRAM = mana dvo
    1919
    20 EXTRAS = sched pclient pcontrol
     20EXTRAS = psched pclient pcontrol
    2121
    2222SKIP =  dimm
  • trunk/Ohana/src/opihi/include/data.h

    r4689 r4693  
    88# define DATA_H
    99
     10/* socket / pipe communication buffer */
     11typedef struct {
     12  char *buffer;
     13  int   Nalloc;
     14  int   Nreset;
     15  int   Nblock;
     16  int   Nbuffer;
     17} IOBuffer;
     18
     19/*** typedef structs used by math functions ***/
     20typedef struct {
     21  int   NLINES;
     22  int   Nlines;
     23  char **lines;
     24  char  *name;
     25} Queue;
     26
    1027void InitData ();
    1128
    12 /* in misc/queues.c */
     29/* IOBuffersOps.c */
     30int InitIOBuffer (IOBuffer *buffer, int Nalloc);
     31int FlushIOBuffer (IOBuffer *buffer);
     32int ReadtoIOBuffer (IOBuffer *buffer, int fd);
     33void FreeIOBuffer (IOBuffer *buffer);
     34
     35/* in queues.c */
    1336void InitQueues ();
    1437void ListQueues ();
     
    1841char *PopQueue (Queue *queue);
    1942
    20 /* in misc/sort.c */
     43/* in sort.c */
    2144void sort (double *value, int N);
    2245void fsort (float *value, int N);
     
    2750void dsort_lists (double *X, double *Y, int *S, int N);
    2851
    29 /* in misc/fft.c */
     52/* in fft.c */
    3053void fft (float *Data, int N, int isign);
    3154void fftold (float *Data, int N, int isign);
     
    3457void fourn (float *data, int *nn, int ndim, int isign);
    3558
    36 /* in misc/gaussj.c */
     59/* in gaussj.c */
    3760int gaussj (double **a, int n, double **b, int m);
    3861int fgaussj (float **a, int n, float **b, int m);
    3962
    40 /* in misc/svdcmp.c */
     63/* in svdcmp.c */
    4164int svdcmp (float *a, float *w, float *v, int Nx, int Ny);
    4265
    43 /* in misc/spline.c */
     66/* in spline.c */
    4467void spline (float *x, float *y, int N, float *y2);
    4568float splint (float *x, float *y, float *y2, int N, float X);
    4669
    47 /* misc/mrqmin.c */
     70/* mrqmin.c */
    4871float mrqcof (float *x, float *y, float *dy, int Npts,
    4972              float *par, int Npar, float **ta, float **tb,
     
    6285void mrqfree (int Npar);
    6386
    64 /* misc/mrq2dmin.c */
     87/* mrq2dmin.c */
    6588float mrq2dcof (float *x, float *t, float *y, float *dy, int Npts,
    6689                float *par, int Npar, float **ta, float **tb,
     
    85108void mrq2dfree (int Npar);
    86109
    87 /* misc/powell.c */
     110/* powell.c */
    88111void powell (float *p, int Npar, float (func)() );
    89112
    90 /* misc/gaussian.c */
     113/* gaussian.c */
    91114double gaussian (double x, double mean, double sigma);
    92115void gauss_init (int Nbin);
    93116double rnd_gauss (double mean, double sigma);
    94117
    95 /* misc/starfuncs.c */
     118/* starfuncs.c */
    96119double get_aperture_stats (Matrix *matrix, int X, int Y, int Npix, int Nborder, double max);
    97120int set_rough_radii (double Ra, double Ri, double Ro);
    98121int get_rough_star (float *data, int Nx, int Ny, int x, int y, float *xc, float *yc, float *sx, float *sy, float *sxy, float *zs, float *zp, float *sk);
    99122
    100 /* misc/precess.c */
     123/* precess.c */
    101124double BtoJ (double in_epoch);
    102125double get_epoch (char *in_epoch, char mode);
    103126
    104 /* misc/graphtools.c */
     127/* graphtools.c */
    105128void          SetLimits             PROTO((Vector *xvec, Vector *yvec, Graphdata *graphmode));
    106129void          ApplyLimits           PROTO((int Xgraph, Graphdata *graphmode, int apply));
  • trunk/Ohana/src/opihi/include/dvomath.h

    r3142 r4693  
    88enum {ANYVECTOR, NEWVECTOR, OLDVECTOR};
    99enum {ANYBUFFER, NEWBUFFER, OLDBUFFER};
    10 
    11 /*** typedef structs used by math functions ***/
    12 typedef struct {
    13   int   NLINES;
    14   int   Nlines;
    15   char **lines;
    16   char  *name;
    17 } Queue;
    1810
    1911typedef struct {                        /* representation of a variable (0-D) */
  • trunk/Ohana/src/opihi/include/pclient.h

    r4689 r4693  
    4040int child_stderr_fd[2];
    4141
    42 typedef struct {
    43   char *buffer;
    44   int   Nalloc;
    45   int   Nreset;
    46   int   Nblock;
    47   int   Nbuffer;
    48 } IOBuffer;
    49 
    5042/** buffers for I/O storage **/
    5143IOBuffer child_stdout;
    5244IOBuffer child_stderr;
    53 
    54 /** IOBuffers allow the following operations **/
    55 
    56 /* create a new, empty IOBuffer with Nalloc free space */
    57 int  InitIOBuffer (IOBuffer *buffer, int Nalloc);
    58 
    59 /* read from the file descriptor into IOBuffer, expanding as needed */
    60 int  ReadtoIOBuffer (IOBuffer *buffer, int fd);
    61 
    62 /* empty the current IOBuffer, realloc to a minimal size */
    63 int  FlushIOBuffer (IOBuffer *buffer);
    64 
    65 /* free memory associated with IOBuffer */
    66 void FreeIOBuffer (IOBuffer *buffer);
    6745
    6846int InitChild ();
  • trunk/Ohana/src/opihi/include/pcontrol.h

    r4689 r4693  
    4242  PCLIENT_GOOD = 1,
    4343} PclientStat;
    44 
    45 typedef struct {
    46   char *buffer;
    47   int   Nalloc;
    48   int   Nreset;
    49   int   Nblock;
    50   int   Nbuffer;
    51 } IOBuffer;
    5244
    5345typedef struct {
     
    109101# define FREE(X) if (X != NULL) { free (X); }
    110102# define CLOSE(FD) { if (FD) close (FD); FD = 0; }
    111 
    112 /** IOBuffers allow the following operations (see pclient.h) **/
    113 int  InitIOBuffer (IOBuffer *buffer, int Nalloc);
    114 int  ReadtoIOBuffer (IOBuffer *buffer, int fd);
    115 int  FlushIOBuffer (IOBuffer *buffer);
    116 void FreeIOBuffer (IOBuffer *buffer);
    117103
    118104void InitPcontrol ();
  • trunk/Ohana/src/opihi/include/psched.h

    r4692 r4693  
    2323
    2424enum {RANGE_ABS, RANGE_DAY, RANGE_WEEK};
    25 
    26 /* socket / pipe communication buffer */
    27 typedef struct {
    28   char *buffer;
    29   int   Nalloc;
    30   int   Nreset;
    31   int   Nblock;
    32   int   Nbuffer;
    33 } IOBuffer;
    3425
    3526typedef struct {
     
    110101/* scheduler prototypes */
    111102
    112 void InitSched ();
    113 
    114 char *memstr (char *m1, char *m2, int n);
     103void InitPsched ();
    115104
    116105void InitTasks ();
     
    165154int PrintControllerOutput ();
    166155
    167 int InitIOBuffer (IOBuffer *buffer, int Nalloc);
    168 int FlushIOBuffer (IOBuffer *buffer);
    169 int ReadtoIOBuffer (IOBuffer *buffer, int fd);
    170 void FreeIOBuffer (IOBuffer *buffer);
    171156int KillControllerJob (Job *job);
    172157int CheckControllerStatus ();
  • trunk/Ohana/src/opihi/lib.data/Makefile

    r3525 r4693  
    3636$(SDIR)/open_graph.$(ARCH).o            \
    3737$(SDIR)/open_image.$(ARCH).o            \
     38$(SDIR)/IOBufferOps.$(ARCH).o           \
    3839$(SDIR)/PlotVectors.$(ARCH).o
    3940
  • trunk/Ohana/src/opihi/pantasks/CheckJobs.c

    r4689 r4693  
    1 # include "scheduler.h"
     1# include "psched.h"
    22
    33int CheckJobs () {
  • trunk/Ohana/src/opihi/pantasks/CheckSystem.c

    r4689 r4693  
    1 # include "scheduler.h"
     1# include "psched.h"
    22
    33int CheckSystem () {
  • trunk/Ohana/src/opihi/pantasks/CheckTasks.c

    r4689 r4693  
    1 # include "scheduler.h"
     1# include "psched.h"
    22
    33int CheckTasks () {
  • trunk/Ohana/src/opihi/pantasks/CheckTimeRanges.c

    r4602 r4693  
    1 # include "scheduler.h"
     1# include "psched.h"
    22
    33int CheckTimeRanges (TimeRange *ranges, int Nranges) {
  • trunk/Ohana/src/opihi/pantasks/ControllerOps.c

    r4689 r4693  
    1 # include "scheduler.h"
     1# include "psched.h"
    22# define CONTROLLER_TIMEOUT 20
    33# define CONNECT_TIMEOUT 300
     
    350350      exit (2);
    351351    case -1:  /* no data in pipe */
    352       break;
    353     case 0:   /* pipe is closed */
    354       /** change child state? **/
    355       break;
     352    case 0:   /* pipe is closed, change child state? **/
    356353    default:  /* data in pipe */
    357354      break;
     
    365362      exit (2);
    366363    case -1:  /* no data in pipe */
    367       break;
    368     case 0:   /* pipe is closed */
    369       /** change child state? **/
    370       break;
     364    case 0:   /* pipe is closed, change child state? **/
    371365    default:  /* data in pipe */
    372366      break;
  • trunk/Ohana/src/opihi/pantasks/JobIDOps.c

    r4689 r4693  
    1 # include "scheduler.h"
     1# include "psched.h"
    22
    33# define MAX_N_JOBS 1000
  • trunk/Ohana/src/opihi/pantasks/JobOps.c

    r4689 r4693  
    1 # include "scheduler.h"
     1# include "psched.h"
    22
    33static Job **jobs;
  • trunk/Ohana/src/opihi/pantasks/LocalJob.c

    r4691 r4693  
    1 # include "scheduler.h"
     1# include "psched.h"
    22
    33/* this could be written a just a one-way pipe */
     
    6666  CheckLocalJobStatus (job);
    6767
    68   /* read stdout buffer */
    69   Nread = ReadtoIOBuffer (&job[0].stdout, job[0].stdout_fd);
    70   switch (Nread) {
    71     case -2:  /* error in read (programming error?  system level error?) */
    72       fprintf (stderr, "serious IO error\n");
    73       exit (2);
    74     case -1:  /* no data in pipe */
    75       break;
    76     case 0:   /* pipe is closed */
    77       /** change child state? **/
    78       break;
    79     default:  /* data in pipe */
    80       break;
    81   }
     68  if ((job[0].state == JOB_EXIT) || (job[0].state == JOB_CRASH)) {
     69    EmptyIOBuffer (&job[0].stdout, job[0].stdout_fd);
     70    EmptyIOBuffer (&job[0].stderr, job[0].stderr_fd);
     71  } else {
     72    /* read stdout buffer */
     73    Nread = ReadtoIOBuffer (&job[0].stdout, job[0].stdout_fd);
     74    switch (Nread) {
     75      case -2:  /* error in read (programming error?  system level error?) */
     76        fprintf (stderr, "serious IO error\n");
     77        exit (2);
     78      case -1:  /* no data in pipe */
     79      case 0:   /* pipe is closed, change child state? **/
     80      default:  /* data in pipe */
     81        break;
     82    }
    8283 
    83   /* read stderr buffer */
    84   Nread = ReadtoIOBuffer (&job[0].stderr, job[0].stderr_fd);
    85   switch (Nread) {
    86     case -2:  /* error in read (programming error?  system level error?) */
    87       fprintf (stderr, "serious IO error\n");
    88       exit (2);
    89     case -1:  /* no data in pipe */
    90       break;
    91     case 0:   /* pipe is closed */
    92       /** change child state? **/
    93       break;
    94     default:  /* data in pipe */
    95       break;
     84    /* read stderr buffer */
     85    Nread = ReadtoIOBuffer (&job[0].stderr, job[0].stderr_fd);
     86    switch (Nread) {
     87      case -2:  /* error in read (programming error?  system level error?) */
     88        fprintf (stderr, "serious IO error\n");
     89        exit (2);
     90      case -1:  /* no data in pipe */
     91      case 0:   /* pipe is closed, change child state? **/
     92      default:  /* data in pipe */
     93        break;
     94    }
    9695  }
    9796  return (TRUE);
     
    101100
    102101  int result, waitstatus;
     102
     103  /*** if child has exited, does the pipe hang around until it is flushed? ***/
     104  /*** who closes the child stdout/stderr fd? */
    103105
    104106  /* check local job status */
  • trunk/Ohana/src/opihi/pantasks/Makefile

    r4691 r4693  
    77LIB     =       $(HOME)/lib
    88INC     =       $(HOME)/include
    9 SDIR    =       $(HOME)/sched
     9SDIR    =       $(HOME)/psched
    1010#
    1111DESTBIN =       $(LBIN)
     
    1313DESTINC =       $(LINC)
    1414DESTMAN =       $(LMAN)
    15 DESTHLP =       $(LHLP)/sched
     15DESTHLP =       $(LHLP)/psched
    1616
    1717INCS    =       -I$(INC) -I$(LINC) -I$(XINC)
     
    2727funcs = \
    2828$(SDIR)/init.$(ARCH).o \
    29 $(SDIR)/scheduler.$(ARCH).o \
     29$(SDIR)/psched.$(ARCH).o \
    3030$(SDIR)/CheckJobs.$(ARCH).o \
    3131$(SDIR)/CheckSystem.$(ARCH).o \
     
    3636$(SDIR)/JobOps.$(ARCH).o \
    3737$(SDIR)/JobIDOps.$(ARCH).o \
    38 $(SDIR)/TaskOps.$(ARCH).o \
    39 $(SDIR)/IOBufferOps.$(ARCH).o
     38$(SDIR)/TaskOps.$(ARCH).o
    4039
    4140cmds = \
     
    6766$(DESTLIB)/libdatacmd.a
    6867
    69 all: scheduler
     68all: psched
    7069
    71 scheduler: $(BIN)/scheduler.$(ARCH)
     70psched: $(BIN)/psched.$(ARCH)
    7271        @echo done
    7372
    74 $(BIN)/scheduler.$(ARCH) : $(funcs) $(cmds) $(libs)
     73$(BIN)/psched.$(ARCH) : $(funcs) $(cmds) $(libs)
    7574
    76 install: $(DESTBIN)/scheduler help
     75install: $(DESTBIN)/psched help
    7776
    78 help: cmd.basic.help cmd.data.help cmd.astro.help sched.help
     77help: cmd.basic.help cmd.data.help cmd.astro.help psched.help
    7978
    8079# utilities #################################################
  • trunk/Ohana/src/opihi/pantasks/TaskOps.c

    r4684 r4693  
    1 # include "scheduler.h"
     1# include "psched.h"
    22
    33static Task **tasks;
  • trunk/Ohana/src/opihi/pantasks/controller.c

    r4689 r4693  
    1 # include "scheduler.h"
     1# include "psched.h"
    22
    33int controller_host    PROTO((int, char **));
  • trunk/Ohana/src/opihi/pantasks/controller_check.c

    r4573 r4693  
    1 # include "scheduler.h"
     1# include "psched.h"
    22
    33int controller_check (int argc, char **argv) {
  • trunk/Ohana/src/opihi/pantasks/controller_exit.c

    r4689 r4693  
    1 # include "scheduler.h"
     1# include "psched.h"
    22
    33int controller_exit (int argc, char **argv) {
  • trunk/Ohana/src/opihi/pantasks/controller_host.c

    r4573 r4693  
    1 # include "scheduler.h"
     1# include "psched.h"
    22
    33int controller_host (int argc, char **argv) {
  • trunk/Ohana/src/opihi/pantasks/controller_output.c

    r4689 r4693  
    1 # include "scheduler.h"
     1# include "psched.h"
    22
    33int controller_output (int argc, char **argv) {
  • trunk/Ohana/src/opihi/pantasks/controller_status.c

    r4573 r4693  
    1 # include "scheduler.h"
     1# include "psched.h"
    22
    33int controller_status (int argc, char **argv) {
  • trunk/Ohana/src/opihi/pantasks/delete.c

    r4689 r4693  
    1 # include "scheduler.h"
     1# include "psched.h"
    22
    33int delete_job (int argc, char **argv) {
  • trunk/Ohana/src/opihi/pantasks/init.c

    r4603 r4693  
    1 # include "scheduler.h"
     1# include "psched.h"
    22
    33int controller      PROTO((int, char **));
     
    4747*/
    4848
    49 void InitSched () {
     49void InitPsched () {
    5050 
    5151  int i;
  • trunk/Ohana/src/opihi/pantasks/job.c

    r4552 r4693  
    1 # include "scheduler.h"
     1# include "psched.h"
    22
    33/* this will require a bit of care: to define a job, we need
  • trunk/Ohana/src/opihi/pantasks/kill.c

    r4689 r4693  
    1 # include "scheduler.h"
     1# include "psched.h"
    22
    33int kill_job (int argc, char **argv) {
  • trunk/Ohana/src/opihi/pantasks/run.c

    r4552 r4693  
    1 # include "scheduler.h"
     1# include "psched.h"
    22
    33int run (int argc, char **argv) {
  • trunk/Ohana/src/opihi/pantasks/status.c

    r4689 r4693  
    1 # include "scheduler.h"
     1# include "psched.h"
    22
    33int status_sys (int argc, char **argv) {
  • trunk/Ohana/src/opihi/pantasks/stop.c

    r4552 r4693  
    1 # include "scheduler.h"
     1# include "psched.h"
    22
    33int stop (int argc, char **argv) {
  • trunk/Ohana/src/opihi/pantasks/task.c

    r4689 r4693  
    1 # include "scheduler.h"
     1# include "psched.h"
    22# define prompt "> "
    33
  • trunk/Ohana/src/opihi/pantasks/task_command.c

    r4684 r4693  
    1 # include "scheduler.h"
     1# include "psched.h"
    22
    33int task_command (int argc, char **argv) {
  • trunk/Ohana/src/opihi/pantasks/task_host.c

    r4689 r4693  
    1 # include "scheduler.h"
     1# include "psched.h"
    22
    33int task_host (int argc, char **argv) {
  • trunk/Ohana/src/opihi/pantasks/task_macros.c

    r4689 r4693  
    1 # include "scheduler.h"
     1# include "psched.h"
    22# define D_NLINES 100
    33# define prompt "> "
  • trunk/Ohana/src/opihi/pantasks/task_nmax.c

    r4684 r4693  
    1 # include "scheduler.h"
     1# include "psched.h"
    22
    33int task_nmax (int argc, char **argv) {
  • trunk/Ohana/src/opihi/pantasks/task_periods.c

    r4689 r4693  
    1 # include "scheduler.h"
     1# include "psched.h"
    22
    33int task_periods (int argc, char **argv) {
  • trunk/Ohana/src/opihi/pantasks/task_trange.c

    r4689 r4693  
    1 # include "scheduler.h"
     1# include "psched.h"
    22
    33int task_trange (int argc, char **argv) {
  • trunk/Ohana/src/opihi/pantasks/verbose.c

    r4602 r4693  
    1 # include "scheduler.h"
     1# include "psched.h"
    22
    33static int VERBOSE = FALSE;
  • trunk/Ohana/src/opihi/pclient/Makefile

    r4691 r4693  
    2828$(SDIR)/init.$(ARCH).o \
    2929$(SDIR)/pclient.$(ARCH).o \
    30 $(SDIR)/IOBufferOps.$(ARCH).o \
    3130$(SDIR)/ChildOps.$(ARCH).o \
    3231
     
    5453install: $(DESTBIN)/pclient help
    5554
    56 help: cmd.basic.help pclient.help
     55help: clean-help cmd.basic.help pclient.help
    5756
    5857# utilities #################################################
     
    9190        rm -f `find . -name "#*"`
    9291
     92clean-help:
     93        @if [ ! -d $(DESTHLP) ]; then mkdir -p $(DESTHLP); fi
     94        rm -f $(DESTHLP)/*
     95
    9396dist: clean
    9497        rm -f $(BIN)/*
  • trunk/Ohana/src/opihi/pcontrol/Makefile

    r4691 r4693  
    3838$(SDIR)/GetJobOutput.$(ARCH).o \
    3939$(SDIR)/HostOps.$(ARCH).o \
    40 $(SDIR)/IOBufferOps.$(ARCH).o \
    4140$(SDIR)/JobID.$(ARCH).o \
    4241$(SDIR)/JobOps.$(ARCH).o \
     
    7473install: $(DESTBIN)/pcontrol help
    7574
    76 help: cmd.basic.help cmd.data.help pcontrol.help
     75help: clean-help cmd.basic.help pcontrol.help
    7776
    7877# utilities #################################################
     
    111110        rm -f `find . -name "#*"`
    112111
     112clean-help:
     113        @if [ ! -d $(DESTHLP) ]; then mkdir -p $(DESTHLP); fi
     114        rm -f $(DESTHLP)/*
     115
    113116dist: clean
    114117        rm -f $(BIN)/*
     
    128131
    129132%.help:
    130         @if [ ! -d $(DESTHLP) ]; then mkdir -p $(DESTHLP); fi
    131133        rm -f $(HOME)/$*/help/*~
    132134        rm -f $(HOME)/$*/help/#*
  • trunk/Ohana/src/opihi/scripts/sched.pro

    r4691 r4693  
    11
    2 controller host alala
     2# controller host alala
    33
    44task test
    5   command date
     5  command ls /data/eugene
    66  periods -poll 1.0
    77  periods -exec 5.0
    88  periods -timeout 10.0
    9   trange 07:09 07:10
    10   trange -exclude 07:09:30 07:09:45
     9  # trange 07:09 07:10
     10  # trange -exclude 07:09:30 07:09:45
     11  nmax 1
    1112  host local
    1213  # host localhost
     
    2021    # note that $stdout/$stderr may contain return characters
    2122    # which will interfere with 'exec'
    22     output success.log
     23    # push ls.list $stdout
    2324    echo $stdout
    24     output stdout
    2525  end
    2626
Note: See TracChangeset for help on using the changeset viewer.