IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 18, 2006, 1:44:51 PM (20 years ago)
Author:
eugene
Message:

successful implementation of the threaded version of pcontrol

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/include/pcontrol.h

    r8297 r8424  
    11# include "data.h"
    22# include "basic.h"
     3# define THREADED
    34
    45typedef struct timeval Ptime;
     
    9899  int    Nobject;
    99100  int    NOBJECT;
    100   // pthread_mutex_t mutex;
     101# ifdef THREADED   
     102  pthread_mutex_t mutex;
     103# endif
    101104} Stack;
    102105
     
    108111# define DTIME(A,B) ((A.tv_sec - B.tv_sec) + 1e-6*(A.tv_usec - B.tv_usec))
    109112# define ZTIME(A) ((A.tv_sec == 0) && (A.tv_usec == 0))
     113
     114// # define ASSERT(TEST,STRING) { if (!(TEST)) { gprint (GP_ERR, "programming error: %s\n", STRING); abort (); }}
     115// # define ABORT(STRING) { gprint (GP_ERR, "programming error: %s\n", STRING); abort (); }
     116# define ASSERT(TEST,STRING) { if (!(TEST)) { gprint (GP_ERR, "programming error: %s\n", STRING); raise (SIGINT); exit (2); }}
     117# define ABORT(STRING) { gprint (GP_ERR, "programming error: %s\n", STRING); raise (SIGINT); exit (2); }
    110118
    111119void InitPcontrol ();
     
    117125void  *PullStackByName (Stack *stack, char *name);
    118126void  *PullStackByID (Stack *stack, int id);
    119 void  *FindStackByID (Stack *stack, int id);
    120 void  *FindStackByName (Stack *stack, char *name);
     127int    RemoveStackEntry (Stack *stack, int where);
     128void  *RemoveStackByID (Stack *stack, int id);
    121129void   LockStack (Stack *stack);
    122130void   UnlockStack (Stack *stack);
    123131
    124 int CheckSystem ();
    125 int CheckBusyJobs (float delay);
    126 int CheckDoneJobs (float delay);
    127 int CheckKillJobs (float delay);
    128 int CheckDoneHosts (float delay);
    129 int CheckLiveHosts (float delay);
    130 int CheckDownHosts (float delay);
    131 int CheckIdleHosts (float delay);
     132// void  *FindStackByID (Stack *stack, int id);
     133// void  *FindStackByName (Stack *stack, char *name);
     134
     135/*** CheckSystem.c ***/
     136int   CheckSystem ();
     137void *CheckSystem_Threaded (void *data);
     138int   CheckBusyJobs (float delay);
     139int   CheckDoneJobs (float delay);
     140int   CheckKillJobs (float delay);
     141int   CheckDoneHosts (float delay);
     142int   CheckDownHosts (float delay);
     143int   CheckIdleHosts (float delay);
     144int   CheckLiveHosts (float delay);
     145int   SetRunSystem (int state);
     146
     147/*** own files ***/
     148int CheckHost (Host *host);
     149int StartHost (Host *host);
    132150int CheckIdleHost (Host *host);
     151int CheckDoneHost (Host *host);
     152int CheckBusyJob (Job *job, Host *host);
     153int CheckDoneJob (Job *job, Host *host);
     154int KillJob (Job *job, Host *host);
     155int StartJob (Job *job, Host *host);
     156int ResetJob (Job *job);
     157int GetJobOutput (char *command, Host *host, IOBuffer *buffer, int Nbytes);
     158int PclientCommand (Host *host, char *command, char *response, IOBuffer *buffer);
     159int rconnect (char *command, char *hostname, char *shell, int *stdio);
     160
     161/*** misc files ***/
     162int    VerboseMode ();  // in verbose.c
     163void   gotsignal (int signum); // in pcontrol.c
     164
     165/*** IDops.c ***/
    133166void InitIDs ();
    134167IDtype NextJobID ();
    135168IDtype NextHostID ();
    136169void PrintID (gpDest dest, IDtype ID);
    137 int CheckBusyJob (Job *job);
    138 int StartHost (Host *host);
    139 int CheckDoneHost (Host *host);
    140 int CheckDoneJob (Job *job);
    141 int GetJobOutput (char *command, Host *host, IOBuffer *buffer, int Nbytes);
    142 int ResetJob (Job *job);
    143 int PclientCommand (Host *host, char *command, char *response, IOBuffer *buffer);
    144 int rconnect (char *command, char *hostname, char *shell, int *stdio);
    145 int CheckHost (Host *host);
    146 
    147 int PrintJobStack (int Nstack);
    148 int PrintHostStack (int Nstack);
    149 
    150 int    VerboseMode ();
    151 
    152 void   gotsignal (int signum);
     170
     171/*** CheckPoint.c ***/
     172int SetCheckPoint ();
     173int ClearCheckPoint ();
     174int TestCheckPoint ();
    153175
    154176/*** HostOps.c ***/
    155177void   InitHostStacks ();
    156178Stack *GetHostStack (int StackID);
     179char  *GetHostStackName (int StackID);
    157180Stack *GetHostStackByName (char *name);
    158181int    PutHost (Host *host, int StackID, int where);
     
    161184Host  *PullHostFromStackByID (int StackID, IDtype ID);
    162185Host  *PullHostFromStackByName (int StackID, char *name);
    163 Host  *FindHostByID (IDtype HostID, int *StackID);
    164 Host  *FindHostByName (char *name, int *StackID);
    165 Host  *FindHostInStackByID (int StackID, IDtype ID);
    166 Host  *FindHostInStackByName (int StackID, char *name);
    167186IDtype AddHost (char *hostname);
    168187void   DelHost (Host *host);
    169188
     189/*** StopHosts.c ***/
    170190void   DownHost (Host *host);
    171191void   OffHost (Host *host);
    172192int    DownHosts ();
     193int    StopHost (Host *host);
    173194int    HarvestHost (int pid);
    174 int    StopHost (Host *host);
    175195
    176196/*** JobOps.c ***/
    177197void   InitJobStacks ();
    178198Stack *GetJobStack (int StackID);
     199char  *GetJobStackName (int StackID);
    179200Stack *GetJobStackByName (char *name);
    180201int    PutJob (Job *job, int StackID, int where);
     
    182203Job   *PullJobByID (IDtype JobID, int *StackID);
    183204Job   *PullJobFromStackByID (int StackID, int ID);
    184 Job   *FindJobByID (IDtype JobID, int *StackID);
    185 Job   *FindJobInStackByID (int StackID, int ID);
    186205IDtype AddJob (char *hostname, JobMode mode, int timeout, int argc, char **argv);
    187206void   DelJob (Job *job);
     
    189208void   LinkJobAndHost (Job *job, Host *host);
    190209
    191 int    KillJob (Job *job);
    192 int    StartJob (Job *job);
     210// Job   *FindJobByID (IDtype JobID, int *StackID);
     211// Job   *FindJobInStackByID (int StackID, int ID);
     212// Host  *FindHostByID (IDtype HostID, int *StackID);
     213// Host  *FindHostByName (char *name, int *StackID);
     214// Host  *FindHostInStackByID (int StackID, IDtype ID);
     215// Host  *FindHostInStackByName (int StackID, char *name);
Note: See TracChangeset for help on using the changeset viewer.