rda-python-common 1.0.35__py3-none-any.whl → 1.0.37__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of rda-python-common might be problematic. Click here for more details.
- rda_python_common/PgFile.py +16 -16
- rda_python_common/PgLOG.py +13 -15
- {rda_python_common-1.0.35.dist-info → rda_python_common-1.0.37.dist-info}/METADATA +1 -1
- {rda_python_common-1.0.35.dist-info → rda_python_common-1.0.37.dist-info}/RECORD +7 -7
- {rda_python_common-1.0.35.dist-info → rda_python_common-1.0.37.dist-info}/WHEEL +0 -0
- {rda_python_common-1.0.35.dist-info → rda_python_common-1.0.37.dist-info}/licenses/LICENSE +0 -0
- {rda_python_common-1.0.35.dist-info → rda_python_common-1.0.37.dist-info}/top_level.txt +0 -0
rda_python_common/PgFile.py
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
# Purpose : python library module to copy, move and delete data files locally
|
|
10
10
|
# and remotely
|
|
11
11
|
#
|
|
12
|
-
# Github : https://github.com/NCAR/rda-
|
|
12
|
+
# Github : https://github.com/NCAR/rda-python-common.git
|
|
13
13
|
#
|
|
14
14
|
###############################################################################
|
|
15
15
|
#
|
|
@@ -101,21 +101,21 @@ QSTATS = {
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
QPOINTS = {
|
|
104
|
-
'L' : '
|
|
105
|
-
'B' : '
|
|
106
|
-
'D' : '
|
|
104
|
+
'L' : 'gdex-glade',
|
|
105
|
+
'B' : 'gdex-quasar',
|
|
106
|
+
'D' : 'gdex-quasar-drdata'
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
QHOSTS = {
|
|
110
|
-
'
|
|
111
|
-
'
|
|
112
|
-
'
|
|
110
|
+
'gdex-glade' : LHOST,
|
|
111
|
+
'gdex-quasar' : BHOST,
|
|
112
|
+
'gdex-quasar-drdata' : DHOST
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
ENDPOINTS = {
|
|
116
|
-
'
|
|
117
|
-
'
|
|
118
|
-
'
|
|
116
|
+
'gdex-glade' : "NCAR RDA GLADE",
|
|
117
|
+
'gdex-quasar' : "NCAR RDA Quasar",
|
|
118
|
+
'gdex-quasar-drdata' : "NCAR RDA Quasar DRDATA"
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
BFILES = {} # cache backup file names and dates for each bid
|
|
@@ -332,7 +332,7 @@ def local_copy_object(tofile, fromfile, bucket = None, meta = None, logact = 0):
|
|
|
332
332
|
# tofiles - target file name list, echo name leading with /dsnnn.n/ on Quasar and
|
|
333
333
|
# leading with /data/ or /decsdata/ on local glade disk
|
|
334
334
|
# fromfiles - source file name list, the same format as the tofiles
|
|
335
|
-
# topoint - target endpoint name, '
|
|
335
|
+
# topoint - target endpoint name, 'gdex-glade', 'gdex-quasar' or 'gdex-quasar-drdata'
|
|
336
336
|
# frompoint - source endpoint name, the same choices as the topoint
|
|
337
337
|
#
|
|
338
338
|
def quasar_multiple_trasnfer(tofiles, fromfiles, topoint, frompoint, logact = 0):
|
|
@@ -374,7 +374,7 @@ def quasar_multiple_trasnfer(tofiles, fromfiles, topoint, frompoint, logact = 0)
|
|
|
374
374
|
# tofile - target file name, leading with /dsnnn.n/ on Quasar and
|
|
375
375
|
# leading with /data/ or /decsdata/ on local glade disk
|
|
376
376
|
# fromfile - source file, the same format as the tofile
|
|
377
|
-
# topoint - target endpoint name, '
|
|
377
|
+
# topoint - target endpoint name, 'gdex-glade', 'gdex-quasar' or 'gdex-quasar-drdata'
|
|
378
378
|
# frompoint - source endpoint name, the same choices as the topoint
|
|
379
379
|
#
|
|
380
380
|
def endpoint_copy_endpoint(tofile, fromfile, topoint, frompoint, logact = 0):
|
|
@@ -532,7 +532,7 @@ def check_globus_finished(tofile, topoint, logact = 0):
|
|
|
532
532
|
def local_copy_backup(tofile, fromfile, endpoint = None, logact = 0):
|
|
533
533
|
|
|
534
534
|
if not endpoint: endpoint = PgLOG.PGLOG['BACKUPEP']
|
|
535
|
-
return endpoint_copy_endpoint(tofile, fromfile, endpoint, '
|
|
535
|
+
return endpoint_copy_endpoint(tofile, fromfile, endpoint, 'gdex-glade', logact)
|
|
536
536
|
|
|
537
537
|
#
|
|
538
538
|
# Copy a Quasar backup file to local Globus endpoint
|
|
@@ -544,7 +544,7 @@ def local_copy_backup(tofile, fromfile, endpoint = None, logact = 0):
|
|
|
544
544
|
def backup_copy_local(tofile, fromfile, endpoint = None, logact = 0):
|
|
545
545
|
|
|
546
546
|
if not endpoint: endpoint = PgLOG.PGLOG['BACKUPEP']
|
|
547
|
-
return endpoint_copy_endpoint(tofile, fromfile, '
|
|
547
|
+
return endpoint_copy_endpoint(tofile, fromfile, 'gdex-glade', endpoint, logact)
|
|
548
548
|
|
|
549
549
|
#
|
|
550
550
|
# Copy a remote file to local
|
|
@@ -1484,7 +1484,7 @@ def local_host_action(host, action, info, logact = 0):
|
|
|
1484
1484
|
if host == "partition":
|
|
1485
1485
|
msg = "for individual partition"
|
|
1486
1486
|
elif host == "rda_config":
|
|
1487
|
-
msg = "via https://
|
|
1487
|
+
msg = "via https://gdex.ucar.edu/internal/rda_pg_config"
|
|
1488
1488
|
elif host in PgLOG.BCHCMDS:
|
|
1489
1489
|
msg = "on a {} Node".format(host)
|
|
1490
1490
|
else:
|
|
@@ -1577,7 +1577,7 @@ def check_rda_file(file, host = LHOST, opt = 0, logact = 0):
|
|
|
1577
1577
|
def check_globus_file(file, endpoint = None, opt = 0, logact = 0):
|
|
1578
1578
|
|
|
1579
1579
|
if not endpoint: endpoint = PgLOG.PGLOG['BACKUPEP']
|
|
1580
|
-
if endpoint == '
|
|
1580
|
+
if endpoint == 'gdex-glade':
|
|
1581
1581
|
if re.match(r'^/(data|decsdata)/', file): file = PgLOG.PGLOG['DSSDATA'] + file
|
|
1582
1582
|
return check_local_file(file, opt, logact)
|
|
1583
1583
|
else:
|
rda_python_common/PgLOG.py
CHANGED
|
@@ -402,15 +402,11 @@ def pglog(msg, logact = MSGLOG):
|
|
|
402
402
|
if logact&EMLLOG: logact &= ~EMLLOG
|
|
403
403
|
if not logact&ERRLOG: logact &= ~EMEROL
|
|
404
404
|
|
|
405
|
-
|
|
406
|
-
|
|
405
|
+
msg = msg.lstrip() if msg else '' # remove leading whitespaces for logging message
|
|
407
406
|
if logact&EXITLG:
|
|
408
407
|
ext = "Exit 1 in {}\n".format(os.getcwd())
|
|
409
|
-
if
|
|
410
|
-
|
|
411
|
-
else:
|
|
412
|
-
msg = msg.rstrip()
|
|
413
|
-
msg += "; " + ext
|
|
408
|
+
if msg: msg = msg.rstrip() + "; "
|
|
409
|
+
msg += ext
|
|
414
410
|
else:
|
|
415
411
|
if msg and not re.search(r'(\n|\r)$', msg): msg += "\n"
|
|
416
412
|
if logact&RETMSG: retmsg = msg
|
|
@@ -418,7 +414,8 @@ def pglog(msg, logact = MSGLOG):
|
|
|
418
414
|
if logact&EMLALL:
|
|
419
415
|
if logact&SNDEML or not msg:
|
|
420
416
|
title = (msg if msg else "Message from {}-{}".format(PGLOG['HOSTNAME'], get_command()))
|
|
421
|
-
msg =
|
|
417
|
+
msg = title + '\n' + msg
|
|
418
|
+
send_email(title.rstrip())
|
|
422
419
|
elif msg:
|
|
423
420
|
set_email(msg, logact)
|
|
424
421
|
|
|
@@ -428,7 +425,8 @@ def pglog(msg, logact = MSGLOG):
|
|
|
428
425
|
if not logact&EMLALL: set_email(msg, logact)
|
|
429
426
|
title = "ABORTS {}-{}".format(PGLOG['HOSTNAME'], get_command())
|
|
430
427
|
set_email((("ABORTS " + CPID['PID']) if CPID['PID'] else title), EMLTOP)
|
|
431
|
-
msg
|
|
428
|
+
msg = title + '\n' + msg
|
|
429
|
+
send_email(title)
|
|
432
430
|
|
|
433
431
|
if logact&LOGERR: # make sure error is always logged
|
|
434
432
|
msg = break_long_string(msg)
|
|
@@ -1315,11 +1313,11 @@ def set_common_pglog():
|
|
|
1315
1313
|
SETPGLOG("DBGLEVEL", '') # debug level
|
|
1316
1314
|
SETPGLOG("DBGPATH", PGLOG['DSSDBHM']+"/log") # path to debug log file
|
|
1317
1315
|
SETPGLOG("OBJCTBKT", "rda-data") # default Bucket on Object Store
|
|
1318
|
-
SETPGLOG("BACKUPEP", "
|
|
1319
|
-
SETPGLOG("DRDATAEP", "
|
|
1316
|
+
SETPGLOG("BACKUPEP", "gdex-quasar") # default Globus Endpoint on Quasar
|
|
1317
|
+
SETPGLOG("DRDATAEP", "gdex-quasar-drdata") # DRDATA Globus Endpoint on Quasar
|
|
1320
1318
|
SETPGLOG("DBGFILE", "pgdss.dbg") # debug file name
|
|
1321
1319
|
SETPGLOG("CNFPATH", PGLOG['DSSHOME']+"/config") # path to configuration files
|
|
1322
|
-
SETPGLOG("DSSURL", "https://
|
|
1320
|
+
SETPGLOG("DSSURL", "https://gdex.ucar.edu") # current dss web URL
|
|
1323
1321
|
SETPGLOG("RQSTURL", "/datasets/request") # request URL path
|
|
1324
1322
|
SETPGLOG("WEBSERVERS", "rda-web-prod01.ucar.edu:rda-web-test01.ucar.edu") # webserver names for Web server
|
|
1325
1323
|
PGLOG['WEBHOSTS'] = PGLOG['WEBSERVERS'].split(':') if PGLOG['WEBSERVERS'] else []
|
|
@@ -1330,7 +1328,7 @@ def set_common_pglog():
|
|
|
1330
1328
|
SETPGLOG("DSSWEB", PGLOG['LOCDATA']+"/web")
|
|
1331
1329
|
SETPGLOG("DSWHOME", PGLOG['DSSWEB']+"/datasets") # datast web root path
|
|
1332
1330
|
PGLOG['HOMEROOTS'] = "{}|{}".format(PGLOG['DSSHOME'], PGLOG['DSWHOME'])
|
|
1333
|
-
SETPGLOG("DSSDATA", "/glade/campaign/collections/
|
|
1331
|
+
SETPGLOG("DSSDATA", "/glade/campaign/collections/gdex") # dss data root path
|
|
1334
1332
|
SETPGLOG("DSDHOME", PGLOG['DSSDATA']+"/data") # dataset data root path
|
|
1335
1333
|
SETPGLOG("DECSHOME", PGLOG['DSSDATA']+"/decsdata") # dataset decsdata root path
|
|
1336
1334
|
SETPGLOG("DSHHOME", PGLOG['DECSHOME']+"/helpfiles") # dataset help root path
|
|
@@ -1354,12 +1352,12 @@ def set_common_pglog():
|
|
|
1354
1352
|
os.environ['history'] = '0'
|
|
1355
1353
|
|
|
1356
1354
|
# set tmp dir
|
|
1357
|
-
SETPGLOG("TMPPATH", "/glade/campaign/collections/
|
|
1355
|
+
SETPGLOG("TMPPATH", "/glade/campaign/collections/gdex/work/ptmp")
|
|
1358
1356
|
if not PGLOG['TMPPATH']: PGLOG['TMPPATH'] = "/data/ptmp"
|
|
1359
1357
|
|
|
1360
1358
|
SETPGLOG("TMPDIR", '')
|
|
1361
1359
|
if not PGLOG['TMPDIR']:
|
|
1362
|
-
PGLOG['TMPDIR'] = "/glade/campaign/collections/
|
|
1360
|
+
PGLOG['TMPDIR'] = "/glade/campaign/collections/gdex/scratch/" + PGLOG['CURUID']
|
|
1363
1361
|
os.environ['TMPDIR'] = PGLOG['TMPDIR']
|
|
1364
1362
|
|
|
1365
1363
|
# empty diretory for HOST-sync
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rda_python_common
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.37
|
|
4
4
|
Summary: RDA Python common library codes shared by other RDA python packages
|
|
5
5
|
Author-email: Zaihua Ji <zji@ucar.edu>
|
|
6
6
|
Project-URL: Homepage, https://github.com/NCAR/rda-python-common
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
rda_python_common/PgCMD.py,sha256=EYjG2Z4zEnvsXE1z-jt5UaNoEKxnOYYiMMzvW6HrKA4,20597
|
|
2
2
|
rda_python_common/PgDBI.py,sha256=12qnRXO7pWv8togtTsOvtVuGtwixnR-s2vLGPpdDfHw,74658
|
|
3
|
-
rda_python_common/PgFile.py,sha256=
|
|
4
|
-
rda_python_common/PgLOG.py,sha256=
|
|
3
|
+
rda_python_common/PgFile.py,sha256=gJuzBxLRYo3HQyNW1WNYDsQWRei2cco9bYEb6uOL8Ds,98487
|
|
4
|
+
rda_python_common/PgLOG.py,sha256=AxEajxYDOzEEsvCEOCQ-WwKTQvL3ufJcOjCJ9el93lQ,55238
|
|
5
5
|
rda_python_common/PgLock.py,sha256=12i84nsGBuifSyPnm8IR63LvHvRuVU573D5QKFlHdOI,22623
|
|
6
6
|
rda_python_common/PgOPT.py,sha256=zX8lWFdfV6GxjLKfMc9eM76mjIjss_ulPieerejcmks,55936
|
|
7
7
|
rda_python_common/PgSIG.py,sha256=ZVM9Qz6yIFurwIQJtV5-CFbKOTdFsZ-Rs95SEpDFgNk,35795
|
|
8
8
|
rda_python_common/PgSplit.py,sha256=QKPbF55m8KCTGmwVwL3uG_nuylCC4FSVfLuXeLjJHbE,8816
|
|
9
9
|
rda_python_common/PgUtil.py,sha256=OqESKCd72b9g8m8jwjPJhXDtPYlW6G8oSOhwChvz2Cg,48600
|
|
10
10
|
rda_python_common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
|
-
rda_python_common-1.0.
|
|
12
|
-
rda_python_common-1.0.
|
|
13
|
-
rda_python_common-1.0.
|
|
14
|
-
rda_python_common-1.0.
|
|
15
|
-
rda_python_common-1.0.
|
|
11
|
+
rda_python_common-1.0.37.dist-info/licenses/LICENSE,sha256=1dck4EAQwv8QweDWCXDx-4Or0S8YwiCstaso_H57Pno,1097
|
|
12
|
+
rda_python_common-1.0.37.dist-info/METADATA,sha256=1_mZhDeUtUXg7GWnZQQlACo3jF1kHYWn2172h1CSbYo,716
|
|
13
|
+
rda_python_common-1.0.37.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
14
|
+
rda_python_common-1.0.37.dist-info/top_level.txt,sha256=KVQmx7D3DD-jsiheqL8HdTrRE14hpRnZY5_ioMArA5k,18
|
|
15
|
+
rda_python_common-1.0.37.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|