00001 /* 00002 * pe.h 00003 * 00004 * Contains the definitions needed for the Pipeline Execution module 00005 * 00006 */ 00007 #ifndef PE_INCL 00008 00009 #ifndef SOI_VERSION_INCL 00010 #include <soi_version.h> 00011 #endif 00012 00013 #include "dsds.h" // This is bad - it redefines a bunch of stuff that is defined differenty in DRMS. But it also defines stuff needed by PE that is not defined in DRMS. 00014 00015 #define PE_VERSION_NUM (0.9) 00016 00017 // BAD - #define SUMSERVER "d02.Stanford.EDU" 00018 00019 #define PELOGFILE "/tmp/pe.%s.%d.log" 00020 #define PEMAILFILE "/tmp/pe.%s.%d.mail" 00021 00022 #define MAX_STR 256 /* max size of a string */ 00023 #define MAX_SERV 128 /* max # of different server progs, e.g. remap_svc */ 00024 #define MAX_ARGS 64 /* max # of entries in argument list from a server */ 00025 #define MAX_ARG_STR 256 /* max size of an arg string */ 00026 #define MSGTIMEOUT 0 /* simulated msg # for a timeout */ 00027 #define MSGUNREGPERPC 241 00028 #define MSGAMPEX 242 00029 #define MSGAMPEX1 243 00030 #define MSGAMPEX2 244 00031 #define MSGKILL 245 /* msg number to tell a server to exit */ 00032 #define MSGTAEL 246 /* msg number for msg from lago servers to lui */ 00033 #define MSGLAGOA 247 /* msg number for requests to lagoa_svc */ 00034 #define MSGLAGOB 248 /* msg number for requests to lagob_svc */ 00035 #define MSGTAEDS 249 /* msg number for msg from dsds_svc to tae peui */ 00036 #define MSGTAEPE 250 /* msg number for msg from pe to tae peui */ 00037 #define MSGLAGO 251 /* msg number for requests to lago_svc */ 00038 #define MSGDSDS 252 /* msg number for requests to dsds_svc */ 00039 #define MSGDSDR 253 /* msg number for request to dsdr_svc (obsolete) */ 00040 #define MSGMSG 254 /* msg number to specify a msg number to a server */ 00041 #define MSGARGS 255 /* msg number for send/receive of arg list */ 00042 #define REQOPEN 1 /* DSDS Open from pe to dsds_svc */ 00043 #define REQREQ 2 /* DSDS Data_Request from pe to dsds_svc */ 00044 #define REQUPDATE 3 /* DSDS Cat_Update from pe to dsds_svc */ 00045 #define REQCLOSE 4 /* DSDS Close from pe to dsds_svc */ 00046 #define REQALLOC 5 /* DSDS Allocate from pe to dsds_svc */ 00047 #define REQDEALLOC 6 /* DSDS Deallocate from pe to dsds_svc */ 00048 #define REQTAEON 7 /* DSDS start send log msgs to tae peui */ 00049 #define REQTAEOFF 8 /* DSDS end send log msgs to tae peui */ 00050 #define REQIMGUPDATE 9 /* DSDS update image info from cvtlm to dsds_svc */ 00051 #define REQDBNAME 10 /* database name request */ 00052 #define TAPEARCH 11 /* to ampex server to start an archive set */ 00053 #define TAPEWRT 12 /* to ampex server to write an archive */ 00054 #define TAPERD 13 /* to ampex server to read an archive */ 00055 #define TAPERET 14 /* to ampex server to start a retrieve */ 00056 #define TAPEDONE 15 /* to ampex server to end an archive set */ 00057 #define TAPEWRTDONE 16 /* to ampex server to indicate write completion */ 00058 #define TAPERDDONE 17 /* to ampex server to indicate read completion */ 00059 #define LAGOA 18 /* from lagoa server to lui to show info */ 00060 #define LAGOB 19 /* from lagob server to lui to show info */ 00061 #define LAGOINFO 20 /* from lago server to lui to show info */ 00062 #define LAGOINIT 21 /* from lago server to lui to give init status */ 00063 #define LAGOREQTAPE 22 /* from lago server to lui to request tape */ 00064 #define LAGOREQBLANK 23 /* from lago server to lui to request blank tape */ 00065 #define LAGOTAEON 24 /* from lui to lago servers to start log msgs */ 00066 #define LAGOTAEOFF 25 /* from lui to lago servers to stop log msgs */ 00067 #define REQREQNR 26 /* DSDS Data_Request to dsds_svc with no retrieval */ 00068 #define REQILOGU 27 /* DSDS ingest_hrsc_log update fr ingest_hrsc_log_svc*/ 00069 #define REQMLOGU 28 /* DSDS merge_hrsc_log update fr merge_hrsc_log_svc*/ 00070 #define LAGOINVENTORY 29 00071 #define LAGOOPENDOOR 30 00072 #define LAGOCLOSEDOOR 31 00073 #define LAGOACCEPT 32 00074 #define LAGOREMOVE 33 00075 #define LAGONOSLOT 34 00076 #define LAGONOBARCODE 35 00077 #define LAGONOTINDB 36 00078 #define REQSQL 37 /* DSDS dynamic sql command */ 00079 #define LAGOKILL 38 00080 #define REQ5KLOGU 39 /* DSDS ingest_5k_log update fr ingest_5k_log_svc*/ 00081 #define AMPEXINIT 40 00082 #define AMPEXINFO 41 00083 #define AMPEXKILL 42 00084 #define AMPEXTAEON 43 00085 #define AMPEXTAEOFF 44 00086 #define AMPEXOPENDOOR 45 00087 #define AMPEXCLOSEDOOR 46 00088 #define AMPEXACCEPT 47 00089 #define AMPEXREMOVE 48 00090 #define AMPEXINVENTORY 49 00091 #define AMPEXREQBLANK 50 00092 #define AMPEXREQTAPE 51 00093 #define AMPEX1 52 00094 #define AMPEX2 53 00095 #define REQUPDATE0 54 /* DSDS Cat_Update0 from pe to dsds_svc */ 00096 #define REQAPUP 55 /* DSDS arch pend change from ampexarc to dsds_svc */ 00097 #define TAPEIN 56 /* to ampex server to insert cartridge */ 00098 #define TAPEINDONE 57 /* to ampex server to indicate that a cartridge 00099 has been inserted */ 00100 #define REQRMRUN 58 /* run msg to dsds_rm */ 00101 #define REQRM 59 /* msg to dsds_svc to find storage for rm */ 00102 #define REQALLOCUP 60 /* msg to dsds_svc to update in-mem lists */ 00103 #define TAPERESERVE 61 /* to ampex server to reserve unit */ 00104 #define TAPERELEASE 62 /* to ampex server to release reserved unit */ 00105 #define AMPEXQON 63 /* to ampex server to enable request queue */ 00106 #define AMPEXQOFF 64 /* to ampex server to disable request queue */ 00107 #define REQDPUP 65 /* DSDS delete pend change to dsds_svc */ 00108 #define AMPEXOPON 66 /* to ampex server to indicate operator on duty */ 00109 #define AMPEXOPOFF 67 /* to ampex server to indicate operator off duty */ 00110 #define TAPERETNOW 68 /* to ampex server to start a retrieve - NO Wait 00111 if cartridge not in unit and no operator */ 00112 #define TAPEARCHNOW 69 /* to ampex server to start an archive - NO Wait 00113 if cartridge not in unit and no operator */ 00114 #define REQREQNOW 70 /* DSDS data req w/retrieval unless on-shelf 00115 and no operator */ 00116 #define AMPEXOP 71 /* to ampex server to ask if operator on duty */ 00117 #define TAPEHAVE 72 /* to ampex server to ask if tape is nearline */ 00118 #define REQREQALL 73 /* DSDS Data_Request for all ds in keylist*/ 00119 #define REQREQALLNR 74 /* as above but w/no Ampex retrieve */ 00120 #define TAPERETMORE 75 /* to ampex server to start another retrieve - 00121 equivalent to TAPEDONE followed by TAPERET 00122 but without interruption by another req */ 00123 #define AMPEXEQ 76 /* to ampex server to require that archives and 00124 retrieves have equal priority */ 00125 #define AMPEXARCH 77 /* to ampex server to require that archives 00126 have priority over retrieves */ 00127 #define AMPEXRET 78 /* to ampex server to require that retrieves 00128 have priority over archives */ 00129 #define TAPECANCEL 79 /* to ampex server to cancel all requests 00130 for the given dsds_uid */ 00131 #define REQTAPECANCEL 80 /* to dsds_svc to do ampex TAPECANCEL */ 00132 #define AMPEXCANCEL 81 /* to ampex server to cancel all queued requests 00133 with the given req_num */ 00134 #define REQDFFLG 82 /* to dsds_svc w/value to set dfflg */ 00135 #define REQREQMV 83 /* to dsds_svc w/datasets to mv to PDS set */ 00136 #define REQMVDPUP 84 /* to dsds_svc to update DP for moved ds */ 00137 00138 /* column locations in pe log file /tmp/pe.pid.log */ 00139 #define C_PE_TID 0 00140 #define C_PE_STATUS 1 00141 #define C_PE_COMPLET 2 00142 #define C_PE_ARCHIVE 3 00143 #define C_PE_MODULE 4 00144 #define C_PE_OUT 5 00145 #define C_PE_AUXINFO 6 00146 00147 /* file with primary and secondary Ampex host names */ 00148 /*#define PHNAME "/home/jim/STAGING/tables/prod_host.cfg"*/ 00149 #define PHNAME "/home/soi/CM/tables/prod_host.cfg" 00150 00151 00152 #include "module.h" 00153 #include "pe_hdata.h" 00154 00155 struct serv_result { 00156 int serv_errno; 00157 int tid; 00158 char *host; 00159 char *out_file; 00160 }; 00161 typedef struct serv_result serv_result; 00162 00163 /* Server definition table. One for each server type. */ 00164 struct server { 00165 char *name; /* name of the remote server program */ 00166 char version[16]; /* version # string such as V0R8B2 */ 00167 int msgid; /* msg # assigned to this server's messages */ 00168 int busyall; /* true if at least one host is busy */ 00169 int firstserver; /* true if first server in the pipe */ 00170 int dsin; /* =1 means to request input from dsds */ 00171 int split; /* =1 to split the fsn-lsn among the hosts */ 00172 int groupid; /* non-0 and same for all servers of a group */ 00173 int cphist; /* cp hist log and map file to output wds */ 00174 int noabort; /* don't abort map file if mod sets abortflg*/ 00175 char archive; /* t=temp, p=perm, n=normal, NULL=no archive */ 00176 int archive_day; /* days form now to archive (t) or del (n) */ 00177 int archive_group; /* 0=no grp, 1=in grp, -1=end of grp */ 00178 int archive_complete; /* 1=archive occured, no crash or abortflg */ 00179 argument arguments[MAX_ARGS]; /* argument list sent from the server */ 00180 KEY *map_list; /* keylist from the map file for this serv */ 00181 HDATA *hosts; /* host dependent info */ 00182 }; 00183 typedef struct server PSERVER; /* originally called SERVER before Rick used it*/ 00184 00185 /* prototypes */ 00186 //extern PADATA *getpadata(PADATA *list, char *wd, long uid); 00187 //extern void setpadata(PADATA **list, char *wd, long uid, double bytes, 00188 //int stat, int substat, char *eff_date, 00189 //int group_id, int safe_id, unsigned long ds_index); 00190 //extern void uidpadata(PADATA *new, PADATA **start, PADATA **end); 00191 //extern void remuidpadata(PADATA **start, PADATA **end, char *wd, long uid); 00192 //extern PADATA *getpawd(PADATA *list, char *wd); 00193 //extern PADATA *getpauid(PADATA *list, long uid); 00194 //extern PADATA *getpanext(PADATA *list); 00195 //extern void rempadata(PADATA **list, char *wd, long uid); 00196 //extern void updpadata(PADATA **list, char *wd, long uid, char *eff_date); 00197 //extern void setpeuid(PEUID **list, long uid, int petid); 00198 //extern PEUID *getpeuid(PEUID *list, long uid); 00199 //extern PEUID *getpeuidnext(PEUID *list); 00200 //extern void rempeuid(PEUID **list, long uid); 00201 extern void pack_args(argument *args); 00202 extern KEY *pack_keylist(KEY *list); 00203 extern KEY *unpack_keylist(KEY *list); 00204 extern HDATA *gethname (HDATA *list, char *host_name); 00205 extern HDATA *gethtid (HDATA *list, int tid); 00206 extern void sethname (HDATA **list, char *host_name); 00207 extern HDATA *sethtid (HDATA *list, char *host_name, int tid); 00208 extern HDATA *gethnext (HDATA *list); 00209 extern HDATA *gethrel (HDATA *oldlist, HDATA *hloc, HDATA *newlist); 00210 extern char *get_effdate(int plusdays); 00211 extern void logkey (KEY *key); 00212 extern void printkey (KEY *key); 00213 extern int start_dsds(char *datab, int *dsdstid, int mytid, 00214 int (*msg)(char *fmt, ...)); 00215 extern KEY *call_dsds(KEY **list, int reqtype, int dsdstid, int mytid, 00216 int (*msgf)(char *fmt, ...), int dbflg); 00217 extern KEY *unpack_dsds(int (*msgf)(char *fmt, ...)); 00218 extern KEY *call_sql(char *scmd, int dsdstid, int mytid, 00219 int (*msg)(char *fmt, ...)); 00220 extern long reg_dsds(int dsdstid, int mytid, int (*msg)(char *fmt, ...)); 00221 extern int dereg_dsds(long uid, int dsdstid, int mytid, 00222 int (*msg)(char *fmt, ...)); 00223 extern int spawn_dsds_local(char *db, int mytid, int *dsdstid, int debugflg, 00224 int (*msgf)(char *fmt, ...)); 00225 extern int spawn_pe_rpc(char *db, int mytid, int *perpctid, int debugflg, 00226 int (*msgf)(char *fmt, ...)); 00227 extern int start_ampex(char *db, int mytid, int perpctid, int *ampextid, 00228 int debugflg, int localflg, int (*msgf)(char *fmt, ...)); 00229 extern int send_ampex_request(KEY *list, int req_num, int mytid, int perpctid, 00230 int (*msgf)(char *fmt, ...)); 00231 extern int send_ampex_local_request(KEY *list, int req_num, int ampextid, 00232 int mytid, int (*msgf)(char *fmt, ...)); 00233 extern void free_key_link(KEY_LINK *link); 00234 extern int set_key_link(KEY_LINK **link, KEY *list, int status); 00235 extern void rm_key_link(KEY_LINK **alink, KEY_LINK *thisone); 00236 extern int pds_wd_2_host(char *wd, char *hostname); 00237 extern int pds_host_2_num(char *hostname); 00238 extern int pds_wd_2_set(char *wd); 00239 extern char *prod_host_prime(); 00240 extern char *prod_host_second(); 00241 00242 #ifdef PVM33 /* for pvm version 3.3 and above */ 00243 #define hostinfo pvmhostinfo 00244 #define taskinfo pvmtaskinfo 00245 #define pvm_serror(x) pvm_setopt(PvmAutoErr,x) 00246 #endif /* PVM33 */ 00247 00248 #define PE_INCL 00249 #endif 00250 00251 /* 00252 $Id: pe.h,v 1.3 2016/02/25 20:53:51 arta Exp $ 00253 $Source: /home/cvsuser/cvsroot/JSOC/proj/jpe/apps/pe.h,v $ 00254 $Author: arta $ 00255 */ 00256 /* $Log: pe.h,v $ 00257 /* Revision 1.3 2016/02/25 20:53:51 arta 00258 /* Changes to jpe so that it works with sha.dsds dataseries. 00259 /* 00260 /* Revision 1.2 2009/04/24 21:51:59 production 00261 /* change SERVER to PSERVER 00262 /* 00263 /* Revision 1.1 2009/02/23 22:44:22 production 00264 /* initial 00265 /* 00266 * Revision 1.70 2008/08/20 19:53:18 jim 00267 * *** empty log message *** 00268 * 00269 * Revision 1.69 2007/01/04 23:46:04 jim 00270 * add SUMSERVER 00271 * 00272 * Revision 1.68 2002/07/02 20:50:39 jim 00273 * call_dsds() now uses KEY ** 00274 * 00275 * Revision 1.67 2001/08/24 17:28:49 jim 00276 * add PHNAME and prod_host_prime/second 00277 * 00278 * Revision 1.66 2000/04/04 19:22:41 jim 00279 * add pds_wd_2_set() 00280 * 00281 * Revision 1.65 2000/03/15 00:31:25 jim 00282 * add REQREQMV 00283 * 00284 * Revision 1.64 1999/10/25 18:41:23 jim 00285 * MAX_ARG_STR 256 00286 * 00287 * Revision 1.63 1999/09/07 18:50:58 jim 00288 * add prototype for pds_wd_2_host & pds_host_2_num 00289 * 00290 * Revision 1.62 1999/04/28 17:18:38 jim 00291 * add REQDFFLG 00292 * 00293 * Revision 1.61 1998/09/09 22:41:06 kay 00294 * added AMPEXCANCEL 00295 * 00296 * Revision 1.60 1998/09/09 22:33:58 jim 00297 * add REQTAPECANCEL 00298 * 00299 * Revision 1.59 1998/09/02 17:16:30 kay 00300 * added TAPECANCEL 00301 * 00302 * Revision 1.58 1998/06/16 22:12:46 kehcheng 00303 * added PVM33 macros for pvm versions 3.3 and above 00304 * 00305 * Revision 1.57 1998/06/01 22:09:40 kehcheng 00306 * changed errno to serv_errno in struct serv_result 00307 * 00308 * Revision 1.56 1997/05/09 23:24:12 jim 00309 * add MSGUNREGPERPC 00310 * 00311 * Revision 1.55 1997/04/16 21:48:10 kehcheng 00312 * added #include <soi_version.h> 00313 * 00314 * Revision 1.54 1997/03/05 01:30:08 kay 00315 * added AMPEXEQ, AMPEXARCH, AMPEXRET to control archive and retrieve priorities 00316 * 00317 * Revision 1.53 1997/02/10 17:20:17 kay 00318 * added TAPERETMORE, a way to allow uninterrupted sequential retrieves 00319 * 00320 * Revision 1.52 1997/01/14 19:24:44 jim 00321 * add prototypes 00322 * 00323 * Revision 1.51 1996/11/19 01:00:31 jim 00324 * add REQREQALL 00325 * 00326 * Revision 1.50 1996/09/23 17:10:02 kay 00327 * added ds_index to setpadata arguments 00328 * 00329 * Revision 1.49 1996/09/10 01:10:00 kay 00330 * added AMPEXOP and TAPEHAVE 00331 * 00332 * Revision 1.48 1996/08/30 17:51:00 jim 00333 * add REQREQNOW 00334 * 00335 * Revision 1.47 1996/08/20 21:27:53 kay 00336 * added request types AMPEXOPON, AMPEXOPOFF, TAPERETNOW, TAPEARCHNOW 00337 * 00338 * Revision 1.46 1996/08/06 21:34:22 jim 00339 * add void remuidpadata(PADATA **start, PADATA **end, char *wd, long uid) 00340 * 00341 * Revision 1.45 1996/07/18 21:09:51 kay 00342 * added stat and safe_id to arguments of setpadata 00343 * 00344 * Revision 1.44 1996/07/09 17:56:22 kay 00345 * added REQDPUP 00346 * 00347 * Revision 1.43 1996/06/21 21:51:59 jim 00348 * add PEMAILFILE 00349 * 00350 * Revision 1.42 1996/06/13 21:01:42 jim 00351 * change history prototype 00352 * 00353 * Revision 1.41 1996/05/08 00:50:46 jim 00354 * changed PELOGFILE 00355 * 00356 * Revision 1.40 1996/05/06 21:41:08 jim 00357 * up MAX_SERV from 64 to 128 00358 * 00359 * Revision 1.39 1996/03/29 00:39:54 kay 00360 * added request types AMPEXQON and AMPEXQOFF to control ampex_svc request queue 00361 * 00362 * Revision 1.38 1996/03/13 16:25:38 kay 00363 * added request types TAPERESERVE and TAPERELEASE 00364 * 00365 * Revision 1.37 1996/03/11 21:41:05 jim 00366 * up MAX_SERV 00367 * 00368 * Revision 1.36 1996/03/04 19:58:17 jim 00369 * add noabort to SERVER 00370 * 00371 * Revision 1.35 1996/02/29 22:57:38 jim 00372 * add cphist field 00373 * 00374 * Revision 1.34 1996/01/24 01:10:30 jim 00375 * add REQALLOCUP 00376 * 00377 * Revision 1.33 1995/12/28 17:51:32 kay 00378 * added TAPEIN and TAPEINDONE request types 00379 * 00380 * Revision 1.32 1995/12/08 00:01:55 jim 00381 * up MAX_SERV to 48 from 32 00382 * 00383 * Revision 1.31 1995/12/02 00:20:45 jim 00384 * add the pe log AT defs 00385 * 00386 * Revision 1.30 1995/12/01 19:52:55 jim 00387 * add PELOGFILE 00388 * 00389 * Revision 1.29 1995/11/15 17:07:36 jim 00390 * added REQAPUP and some prototypes 00391 * 00392 * Revision 1.28 1995/08/16 23:25:24 jim 00393 * added archive_complete to SERVER struct 00394 * 00395 * Revision 1.27 1995/06/19 15:56:50 jayasree 00396 * added group_id to tape structure. 00397 * 00398 * Revision 1.26 1995/06/05 18:04:42 jim 00399 * add REQUPDATE0 00400 * 00401 * Revision 1.25 1995/04/24 18:05:28 kay 00402 * added AMPEX message and request numbers 00403 * 00404 * Revision 1.24 1995/04/20 23:01:12 jim 00405 * changed setpadata prototype for double bytes 00406 * 00407 * Revision 1.23 1995/03/27 22:30:56 jim 00408 * fixed bad comment on last checkin 00409 * 00410 * Revision 1.22 1995/03/27 22:28:06 jim 00411 * added to SERVER int archive_group; 0=no grp, 1=in grp, -1=end of grp 00412 * 00413 * Revision 1.21 1995/03/07 21:38:05 jim 00414 * added REQ5KLOGU 00415 * 00416 * Revision 1.20 1995/01/19 22:07:27 jim 00417 * add LAGOKILL def 00418 * 00419 * Revision 1.19 1995/01/19 18:03:47 jim 00420 * add unpack_dsds() prototype 00421 * 00422 * Revision 1.18 1995/01/17 18:59:36 jim 00423 * changed call_dsds() prototype for int (*msg) 00424 * 00425 * Revision 1.17 1995/01/10 18:30:57 jim 00426 * new prototypes 00427 * 00428 * Revision 1.16 1994/11/11 17:31:41 kay 00429 * eliminated duplicate message number 34 00430 * 00431 * Revision 1.15 1994/11/11 17:19:50 jim 00432 * add REQSQL 00433 * 00434 * Revision 1.14 1994/10/17 22:00:01 jim 00435 * no change 00436 * 00437 * Revision 1.13 1994/10/17 19:05:09 jim 00438 * changed MAX_SERV to 24 00439 * 00440 * Revision 1.12 1994/09/16 16:19:23 kay 00441 * restored previous numbers for DSDS requests 00442 * 00443 * Revision 1.11 1994/09/16 00:26:01 kay 00444 * added prototypes for logkey and printkey and 00445 * added some lago message types 00446 * 00447 * Revision 1.10 1994/09/02 17:55:44 jim 00448 * add prototype for uidpadata 00449 * 00450 * Revision 1.9 1994/09/02 17:48:03 jim 00451 * add groupid, archive, archive_day to SERVER. Elim elbow and oneserver. 00452 * 00453 * Revision 1.8 1994/07/19 21:07:37 jim 00454 * added REQILOGU and REQMLOGU 00455 * 00456 * Revision 1.7 1994/06/07 15:36:58 CM 00457 * CM changed MAX_ARGS to 64 00458 * 00459 * Revision 1.6 1994/06/01 18:53:52 jim 00460 * made version in server table a string. added reqreqnr. 00461 * 00462 * Revision 1.5 1994/04/15 18:50:46 jim 00463 * add REQREQNR 00464 * 00465 * Revision 1.4 1994/04/13 22:08:47 jim 00466 * added MSGKILL 00467 * 00468 * Revision 1.3 1994/03/08 21:07:28 kay 00469 * renumbered request codes to be unique 00470 * 00471 * Revision 1.2 1994/02/28 20:37:41 kay 00472 * added message and request types to support lui (Lago User Interface) 00473 * 00474 * Revision 1.1 1994/02/16 23:21:14 CM 00475 * Initial revision 00476 * */