113113}
114114
115115ENDPOINTS = {
116- 'gdex-glade' : "NCAR RDA GLADE" ,
117- 'gdex-quasar' : "NCAR RDA Quasar" ,
118- 'gdex-quasar-drdata' : "NCAR RDA Quasar DRDATA"
116+ 'gdex-glade' : "NCAR GDEX GLADE" ,
117+ 'gdex-quasar' : "NCAR GDEX Quasar" ,
118+ 'gdex-quasar-drdata' : "NCAR GDEX Quasar DRDATA"
119119}
120120
121121BFILES = {} # cache backup file names and dates for each bid
@@ -163,7 +163,7 @@ def errlog(msg, etype, retry = 0, logact = 0):
163163#
164164# Return 1 if successful 0 if failed with error message generated in PgLOG.pgsystem() cached in PgLOG.PGLOG['SYSERR']
165165#
166- def copy_rda_file (tofile , fromfile , tohost = LHOST , fromhost = LHOST , logact = 0 ):
166+ def copy_gdex_file (tofile , fromfile , tohost = LHOST , fromhost = LHOST , logact = 0 ):
167167
168168 thost = strip_host_name (tohost )
169169 fhost = strip_host_name (fromhost )
@@ -192,6 +192,8 @@ def copy_rda_file(tofile, fromfile, tohost = LHOST, fromhost = LHOST, logact = 0
192192
193193 return errlog ("{}-{}->{}-{}: Cannot copy file" .format (fhost , fromfile , thost , tofile ), 'O' , 1 , PgLOG .LGEREX )
194194
195+ copy_rda_file = copy_gdex_file
196+
195197#
196198# Copy a file locally
197199#
@@ -300,7 +302,7 @@ def local_copy_object(tofile, fromfile, bucket = None, meta = None, logact = 0):
300302 if not bucket : bucket = PgLOG .PGLOG ['OBJCTBKT' ]
301303 if meta is None : meta = {}
302304 if 'user' not in meta : meta ['user' ] = PgLOG .PGLOG ['CURUID' ]
303- if 'group' not in meta : meta ['group' ] = PgLOG .PGLOG ['RDAGRP ' ]
305+ if 'group' not in meta : meta ['group' ] = PgLOG .PGLOG ['GDEXGRP ' ]
304306 uinfo = json .dumps (meta )
305307
306308 finfo = check_local_file (fromfile , 0 , logact )
@@ -332,7 +334,7 @@ def local_copy_object(tofile, fromfile, bucket = None, meta = None, logact = 0):
332334# tofiles - target file name list, echo name leading with /dsnnn.n/ on Quasar and
333335# leading with /data/ or /decsdata/ on local glade disk
334336# fromfiles - source file name list, the same format as the tofiles
335- # topoint - target endpoint name, 'gdex-glade', 'gdex-quasar' or 'gdex-quasar-drdata '
337+ # topoint - target endpoint name, 'gdex-glade', 'gdex-quasar' or 'gdex-quasar-dgdexta '
336338# frompoint - source endpoint name, the same choices as the topoint
337339#
338340def quasar_multiple_trasnfer (tofiles , fromfiles , topoint , frompoint , logact = 0 ):
@@ -374,7 +376,7 @@ def quasar_multiple_trasnfer(tofiles, fromfiles, topoint, frompoint, logact = 0)
374376# tofile - target file name, leading with /dsnnn.n/ on Quasar and
375377# leading with /data/ or /decsdata/ on local glade disk
376378# fromfile - source file, the same format as the tofile
377- # topoint - target endpoint name, 'gdex-glade', 'gdex-quasar' or 'gdex-quasar-drdata '
379+ # topoint - target endpoint name, 'gdex-glade', 'gdex-quasar' or 'gdex-quasar-dgdexta '
378380# frompoint - source endpoint name, the same choices as the topoint
379381#
380382def endpoint_copy_endpoint (tofile , fromfile , topoint , frompoint , logact = 0 ):
@@ -689,7 +691,7 @@ def object_copy_remote(tofile, fromfile, host, bucket = None, logact = 0):
689691#
690692# Return 1 if successful 0 if failed with error message generated in PgLOG.pgsystem() cached in PgLOG.PGLOG['SYSERR']
691693#
692- def delete_rda_file (file , host , logact = 0 ):
694+ def delete_gdex_file (file , host , logact = 0 ):
693695
694696 shost = strip_host_name (host )
695697 if PgUtil .pgcmp (shost , LHOST , 1 ) == 0 :
@@ -699,6 +701,8 @@ def delete_rda_file(file, host, logact = 0):
699701 else :
700702 return delete_remote_file (file , host , logact )
701703
704+ delete_rda_file = delete_gdex_file
705+
702706#
703707# Delete a local file/irectory
704708#
@@ -784,7 +788,7 @@ def delete_backup_file(file, endpoint = None, logact = 0):
784788 return PgLOG .FAILURE
785789
786790#
787- # reset local file/directory information to make them writable for PgLOG.PGLOG['RDAUSER ']
791+ # reset local file/directory information to make them writable for PgLOG.PGLOG['GDEXUSER ']
788792# file - file name (mandatory)
789793# info - gathered file info with option 14, None means file not exists
790794#
@@ -817,8 +821,8 @@ def reset_local_directory(dir, info = None, logact = 0):
817821 if info :
818822 if info ['mode' ] and info ['mode' ] != 0o775 :
819823 ret += set_local_mode (dir , 0 , 0o775 , info ['mode' ], info ['logname' ], logact )
820- if info ['group' ] and PgLOG .PGLOG ['RDAGRP ' ] != info ['group' ]:
821- ret += change_local_group (dir , PgLOG .PGLOG ['RDAGRP ' ], info ['group' ], info ['logname' ], logact )
824+ if info ['group' ] and PgLOG .PGLOG ['GDEXGRP ' ] != info ['group' ]:
825+ ret += change_local_group (dir , PgLOG .PGLOG ['GDEXGRP ' ], info ['group' ], info ['logname' ], logact )
822826
823827 return 1 if ret else 0
824828
@@ -833,8 +837,8 @@ def reset_local_file(file, info = None, logact = 0):
833837 if info :
834838 if info ['mode' ] != 0o664 :
835839 ret += set_local_mode (file , 1 , 0o664 , info ['mode' ], info ['logname' ], logact )
836- if PgLOG .PGLOG ['RDAGRP ' ] != info ['group' ]:
837- ret += change_local_group (file , PgLOG .PGLOG ['RDAGRP ' ], info ['group' ], info ['logname' ], logact )
840+ if PgLOG .PGLOG ['GDEXGRP ' ] != info ['group' ]:
841+ ret += change_local_group (file , PgLOG .PGLOG ['GDEXGRP ' ], info ['group' ], info ['logname' ], logact )
838842
839843 return ret
840844
@@ -847,7 +851,7 @@ def reset_local_file(file, info = None, logact = 0):
847851#
848852# Return PgLOG.SUCCESS if successful PgLOG.FAILURE otherwise
849853#
850- def move_rda_file (tofile , fromfile , host , logact = 0 ):
854+ def move_gdex_file (tofile , fromfile , host , logact = 0 ):
851855
852856 shost = strip_host_name (host )
853857 if PgUtil .pgcmp (shost , LHOST , 1 ) == 0 :
@@ -857,6 +861,8 @@ def move_rda_file(tofile, fromfile, host, logact = 0):
857861 else :
858862 return move_remote_file (tofile , fromfile , host , logact )
859863
864+ move_rda_file = move_gdex_file
865+
860866#
861867# Move a file locally
862868#
@@ -1071,7 +1077,7 @@ def move_backup_file(tofile, fromfile, endpoint = None, logact = 0):
10711077#
10721078# Return PgLOG.SUCCESS(1) if successful or PgLOG.FAILURE(0) if failed
10731079#
1074- def make_rda_directory (dir , host , logact = 0 ):
1080+ def make_gdex_directory (dir , host , logact = 0 ):
10751081
10761082 if not dir : return PgLOG .SUCCESS
10771083 shost = strip_host_name (host )
@@ -1080,6 +1086,8 @@ def make_rda_directory(dir, host, logact = 0):
10801086 else :
10811087 return make_remote_directory (dir , host , logact )
10821088
1089+ make_rda_directory = make_gdex_directory
1090+
10831091#
10841092# Make a local directory
10851093#
@@ -1239,14 +1247,16 @@ def is_root_directory(dir, etype, host = None, action = None, logact = 0):
12391247#
12401248# set mode for a given direcory/file on a given host (include local host)
12411249#
1242- def set_rda_mode (file , isfile , host , nmode = None , omode = None , logname = None , logact = 0 ):
1250+ def set_gdex_mode (file , isfile , host , nmode = None , omode = None , logname = None , logact = 0 ):
12431251
12441252 shost = strip_host_name (host )
12451253 if PgUtil .pgcmp (shost , LHOST , 1 ) == 0 :
12461254 return set_local_mode (file , isfile , nmode , omode , logname , logact )
12471255 else :
12481256 return set_remote_mode (file , isfile , host , nmode , omode , logact )
12491257
1258+ set_rda_mode = set_gdex_mode
1259+
12501260#
12511261# set mode for given local directory or file
12521262#
@@ -1292,7 +1302,7 @@ def set_remote_mode(file, isfile, host, nmode = 0, omode = 0, logact = 0):
12921302def change_local_group (file , ngrp = None , ogrp = None , logname = None , logact = 0 ):
12931303
12941304 if not ngrp :
1295- ngid = PgLOG .PGLOG ['RDAGID ' ]
1305+ ngid = PgLOG .PGLOG ['GDEXGID ' ]
12961306 else :
12971307 ngid = grp .getgrnam [ngrp ].gr_gid
12981308 if logact and logact & PgLOG .EXITLG : logact &= ~ PgLOG .EXITLG
@@ -1455,7 +1465,7 @@ def check_service_accessibilty(sname, fhost = None, logact = 0):
14551465 if not fhost : fhost = PgLOG .PGLOG ['HOSTNAME' ]
14561466 pgrec = PgDBI .pgget ("dsservice" , "*" , "service = '{}' AND hostname = '{}'" .format (sname , fhost ), logact )
14571467 if not pgrec :
1458- PgLOG .pglog ("dsservice: Access {} from {} is not defined in RDA Configuration" .format (sname , fhost ), logact )
1468+ PgLOG .pglog ("dsservice: Access {} from {} is not defined in GDEX Configuration" .format (sname , fhost ), logact )
14591469 return - 1
14601470
14611471 path = sname if (pgrec ['flag' ] == "H" or pgrec ['flag' ] == "G" ) else None
@@ -1484,7 +1494,7 @@ def local_host_action(host, action, info, logact = 0):
14841494 if host == "partition" :
14851495 msg = "for individual partition"
14861496 elif host == "rda_config" :
1487- msg = "via https://gdex.ucar.edu/internal/ rda_pg_config"
1497+ msg = "via https://gdex.ucar.edu/rda_pg_config"
14881498 elif host in PgLOG .BCHCMDS :
14891499 msg = "on a {} Node" .format (host )
14901500 else :
@@ -1555,7 +1565,7 @@ def strip_host_name(host):
15551565#
15561566# Return a dict of file info, or None if file not exists
15571567#
1558- def check_rda_file (file , host = LHOST , opt = 0 , logact = 0 ):
1568+ def check_gdex_file (file , host = LHOST , opt = 0 , logact = 0 ):
15591569
15601570 shost = strip_host_name (host )
15611571
@@ -1570,6 +1580,8 @@ def check_rda_file(file, host = LHOST, opt = 0, logact = 0):
15701580 else :
15711581 return check_remote_file (file , host , opt , logact )
15721582
1583+ check_rda_file = check_gdex_file
1584+
15731585#
15741586# wrapper to check_local_file() and check_globus_file() to check info for a file
15751587# on local or remote Globus endpoints
@@ -1686,7 +1698,7 @@ def local_path_size(pname):
16861698# file: remote File name
16871699# opt: 0 - get data size only (fname, data_size, isfile), fname is the file basename
16881700# 1 - get date/time modified (date_modified, time_modfied)
1689- # 2 - file owner's login name (logname), assumed 'rdadata '
1701+ # 2 - file owner's login name (logname), assumed 'gdexdata '
16901702# 4 - get permission mode in 3 octal digits (mode)
16911703# 8 - get group name (group), assumed 'dss'
16921704# 16 - get week day 0-Sunday, 1-Monday (week_day)
@@ -1743,8 +1755,8 @@ def remote_file_stat(line, opt):
17431755 info ['time_modified' ] = mtime
17441756 if opt & 16 : info ['week_day' ] = PgUtil .get_weekday (mdate )
17451757
1746- if opt & 2 : info ['logname' ] = "rdadata "
1747- if opt & 8 : info ['group' ] = PgLOG .PGLOG ['RDAGRP ' ]
1758+ if opt & 2 : info ['logname' ] = "gdexdata "
1759+ if opt & 8 : info ['group' ] = PgLOG .PGLOG ['GDEXGRP ' ]
17481760
17491761 return info
17501762
@@ -2100,7 +2112,7 @@ def ftp_file_stat(line, opt):
21002112#
21012113# Return: a dict with filenames as keys None if empty directory
21022114#
2103- def rda_glob (dir , host , opt = 0 , logact = 0 ):
2115+ def gdex_glob (dir , host , opt = 0 , logact = 0 ):
21042116
21052117 shost = strip_host_name (host )
21062118 if PgUtil .pgcmp (shost , LHOST , 1 ) == 0 :
@@ -2112,6 +2124,8 @@ def rda_glob(dir, host, opt = 0, logact = 0):
21122124 else :
21132125 return remote_glob (dir , host , opt , logact )
21142126
2127+ rda_glob = gdex_glob
2128+
21152129#
21162130# get an array of directories/files under given dir on local host
21172131#
@@ -2151,7 +2165,7 @@ def local_glob(dir, opt = 0, logact = 0):
21512165# host: host name the directory on, default to LHOST
21522166# opt: 0 - get data size only (fname, data_size, isfile), fname is the file basename
21532167# 1 - get date/time modified (date_modified, time_modfied)
2154- # 2 - file owner's login name (logname), assumed 'rdadata '
2168+ # 2 - file owner's login name (logname), assumed 'gdexdata '
21552169# 4 - get permission mode in 3 octal digits (mode)
21562170# 8 - get group name (group), assumed 'dss'
21572171# 16 - get week day 0-Sunday, 1-Monday (week_day)
@@ -2409,9 +2423,9 @@ def clean_delete_directory(logact = 0):
24092423 for dir in DELDIRS :
24102424 host = DELDIRS [dir ]
24112425 dinfo = (dir if host == LHOST else "{}-{}" .format (host , dir ))
2412- dstat = rda_empty_directory (dir , DELDIRS [dir ])
2426+ dstat = gdex_empty_directory (dir , DELDIRS [dir ])
24132427 if dstat == 0 :
2414- if delete_rda_file (dir , host , logact ):
2428+ if delete_gdex_file (dir , host , logact ):
24152429 PgLOG .pglog (dinfo + ": Empty directory removed" , lact )
24162430 elif dstat > 0 :
24172431 if dstat == 1 and lvl > 0 : PgLOG .pglog (dinfo + ": Directory not empty yet" , lact )
@@ -2433,7 +2447,7 @@ def clean_empty_directory(dir, host, logact = 0):
24332447
24342448 if not dir : return 0
24352449
2436- dirs = rda_glob (dir , host )
2450+ dirs = gdex_glob (dir , host )
24372451 cnt = 0
24382452 if logact :
24392453 lact = logact & ~ PgLOG .EXITLG
@@ -2448,7 +2462,7 @@ def clean_empty_directory(dir, host, logact = 0):
24482462
24492463 dinfo = (dir if same_hosts (host , LHOST ) else "{}-{}" .format (host , dir ))
24502464 if cnt == 0 :
2451- if delete_rda_file (dir , host , logact ):
2465+ if delete_gdex_file (dir , host , logact ):
24522466 PgLOG .pglog (dinfo + ": Empty directory removed" , lact )
24532467 return 1
24542468 else :
@@ -2462,7 +2476,7 @@ def clean_empty_directory(dir, host, logact = 0):
24622476#
24632477# Return: 0 if empty directory, 1 if not empty and -1 if invalid directory
24642478#
2465- def rda_empty_directory (dir , host ):
2479+ def gdex_empty_directory (dir , host ):
24662480
24672481 shost = strip_host_name (host )
24682482
@@ -2471,6 +2485,8 @@ def rda_empty_directory(dir, host):
24712485 else :
24722486 return remote_empty_directory (dir , host )
24732487
2488+ rda_empty_directory = gdex_empty_directory
2489+
24742490#
24752491# return 0 if empty local directory, 1 if not; -1 if cannot remove
24762492#
@@ -2505,13 +2521,15 @@ def remote_empty_directory(dir, host):
25052521#
25062522# return: array of file sizes size is -1 if file does not exist
25072523#
2508- def rda_file_sizes (files , host , logact = 0 ):
2524+ def gdex_file_sizes (files , host , logact = 0 ):
25092525
25102526 sizes = []
2511- for file in files : sizes .append (rda_file_size (file , host , 2 , logact ))
2527+ for file in files : sizes .append (gdex_file_size (file , host , 2 , logact ))
25122528
25132529 return sizes
25142530
2531+ rda_file_sizes = gdex_file_sizes
2532+
25152533#
25162534# get sizes of local files
25172535#
@@ -2540,15 +2558,15 @@ def local_file_sizes(files, logact = 0):
25402558# -1 - file not exists
25412559# -2 - error check file
25422560#
2543- def rda_file_size (file , host , opt = 0 , logact = 0 ):
2561+ def gdex_file_size (file , host , opt = 0 , logact = 0 ):
25442562
2545- info = check_rda_file (file , host , 0 , logact )
2563+ info = check_gdex_file (file , host , 0 , logact )
25462564 if info :
25472565 if info ['isfile' ] and info ['data_size' ] < PgLOG .PGLOG ['MINSIZE' ]:
25482566 if opt :
25492567 if opt & 2 : errlog ("{}-{}: {} file" .format (host , file , ("Too small({}B)" .format (info ['data_size' ]) if info ['data_size' ] > 0 else "Empty" )),
25502568 'O' , 1 , logact )
2551- if opt & 1 : delete_rda_file (file , host , logact )
2569+ if opt & 1 : delete_gdex_file (file , host , logact )
25522570 return 0
25532571 else :
25542572 return info ['data_size' ] # if not regular file or not empty
@@ -2559,6 +2577,8 @@ def rda_file_size(file, host, opt = 0, logact = 0):
25592577 if opt & 4 : errlog ("{}-{}: {}" .format (host , file , PgLOG .PGLOG ['MISSFILE' ]), 'O' , 1 , logact )
25602578 return - 1 # file not exist
25612579
2580+ rda_file_size = gdex_file_size
2581+
25622582#
25632583# check if a local file is empty or too small to be considered valid
25642584#
@@ -3049,7 +3069,7 @@ def check_storage_dflags(dflags, dscheck = None, logact = 0):
30493069 return msgary
30503070
30513071#
3052- # check a RDA file is backed up or not for given file record;
3072+ # check a GDEX file is backed up or not for given file record;
30533073# clear the cached bfile records if frec is None.
30543074# return 0 if not yet, 1 if backed up, or -1 if backed up but modified
30553075#
0 commit comments