rda-python-common 1.0.18__py3-none-any.whl → 1.0.21__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 +33 -18
- {rda_python_common-1.0.18.dist-info → rda_python_common-1.0.21.dist-info}/METADATA +2 -1
- {rda_python_common-1.0.18.dist-info → rda_python_common-1.0.21.dist-info}/RECORD +6 -6
- {rda_python_common-1.0.18.dist-info → rda_python_common-1.0.21.dist-info}/WHEEL +0 -0
- {rda_python_common-1.0.18.dist-info → rda_python_common-1.0.21.dist-info}/licenses/LICENSE +0 -0
- {rda_python_common-1.0.18.dist-info → rda_python_common-1.0.21.dist-info}/top_level.txt +0 -0
rda_python_common/PgFile.py
CHANGED
|
@@ -67,7 +67,7 @@ OHOST = PgLOG.PGLOG['OBJCTSTR']
|
|
|
67
67
|
BHOST = PgLOG.PGLOG['BACKUPNM']
|
|
68
68
|
DHOST = PgLOG.PGLOG['DRDATANM']
|
|
69
69
|
OBJCTCMD = "isd_s3_cli"
|
|
70
|
-
BACKCMD = "dsglobus"
|
|
70
|
+
BACKCMD = "dsglobus"
|
|
71
71
|
|
|
72
72
|
HLIMIT = 0 # HTAR file count limit
|
|
73
73
|
BLIMIT = 2 # minimum back tar file size in DB
|
|
@@ -338,17 +338,28 @@ def local_copy_object(tofile, fromfile, bucket = None, meta = None, logact = 0):
|
|
|
338
338
|
def quasar_multiple_trasnfer(tofiles, fromfiles, topoint, frompoint, logact = 0):
|
|
339
339
|
|
|
340
340
|
ret = PgLOG.FAILURE
|
|
341
|
-
|
|
342
|
-
# qstr = '{"action":"transfer","label":"%s",' % ENDPOINTS[topoint]
|
|
343
|
-
qstr += '"source_endpoint":"%s","destination_endpoint":"%s","files":[\n' % (frompoint, topoint)
|
|
341
|
+
|
|
344
342
|
fcnt = len(fromfiles)
|
|
345
|
-
|
|
343
|
+
transfer_files = {"files": []}
|
|
346
344
|
for i in range(fcnt):
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
345
|
+
transfer_files["files"].append({
|
|
346
|
+
"source_file": fromfiles[i],
|
|
347
|
+
"destination_file": tofiles[i]
|
|
348
|
+
})
|
|
349
|
+
qstr = json.dumps(transfer_files)
|
|
350
|
+
|
|
351
|
+
action = 'transfer'
|
|
352
|
+
source_endpoint = frompoint
|
|
353
|
+
destination_endpoint = topoint
|
|
354
|
+
label = f"{ENDPOINTS[frompoint]} to {ENDPOINTS[topoint]} {action}"
|
|
355
|
+
verify_checksum = True
|
|
356
|
+
|
|
357
|
+
cmd = f'{BACKCMD} {action} -se {source_endpoint} -de {destination_endpoint} --label "{label}"'
|
|
358
|
+
if verify_checksum:
|
|
359
|
+
cmd += ' -vc'
|
|
360
|
+
cmd += ' --batch -'
|
|
361
|
+
|
|
362
|
+
task = submit_globus_task(cmd, topoint, logact, qstr)
|
|
352
363
|
if task['stat'] == 'S':
|
|
353
364
|
ret = PgLOG.SUCCESS
|
|
354
365
|
elif task['stat'] == 'A':
|
|
@@ -379,7 +390,9 @@ def endpoint_copy_endpoint(tofile, fromfile, topoint, frompoint, logact = 0):
|
|
|
379
390
|
if tinfo and tinfo['data_size'] > 0:
|
|
380
391
|
return PgLOG.pglog("{}-{}: file exists already".format(topoint, tofile), logact)
|
|
381
392
|
|
|
382
|
-
|
|
393
|
+
action = 'transfer'
|
|
394
|
+
cmd = f'{BACKCMD} {action} -se {frompoint} -de {topoint} -sf {fromfile} -df {tofile} -vc'
|
|
395
|
+
|
|
383
396
|
task = submit_globus_task(cmd, topoint, logact)
|
|
384
397
|
if task['stat'] == 'S':
|
|
385
398
|
ret = PgLOG.SUCCESS
|
|
@@ -435,7 +448,8 @@ def check_globus_status(taskid, endpoint = None, logact = 0):
|
|
|
435
448
|
if not taskid: return ret
|
|
436
449
|
if not endpoint: endpoint = PgLOG.PGLOG['BACKUPEP']
|
|
437
450
|
mp = r'Status:\s+({})'.format('|'.join(QSTATS.values()))
|
|
438
|
-
|
|
451
|
+
|
|
452
|
+
cmd = f"{BACKCMD} get-task {taskid}"
|
|
439
453
|
astats = ['OK', 'Queued']
|
|
440
454
|
|
|
441
455
|
for loop in range(2):
|
|
@@ -452,7 +466,7 @@ def check_globus_status(taskid, endpoint = None, logact = 0):
|
|
|
452
466
|
if logact&PgLOG.NOWAIT:
|
|
453
467
|
errmsg = "{}: Cancel Task due to {}:\n{}".format(taskid, detail, buf)
|
|
454
468
|
errlog(errmsg, 'B', 1, logact)
|
|
455
|
-
ccmd = "{} -
|
|
469
|
+
ccmd = f"{BACKCMD} cancel-task {taskid}"
|
|
456
470
|
PgLOG.pgsystem(ccmd, logact, 7)
|
|
457
471
|
else:
|
|
458
472
|
time.sleep(PgSIG.PGSIG['ETIME'])
|
|
@@ -759,7 +773,7 @@ def delete_backup_file(file, endpoint = None, logact = 0):
|
|
|
759
773
|
info = check_backup_file(file, endpoint, 0, logact)
|
|
760
774
|
if not info: return PgLOG.FAILURE
|
|
761
775
|
|
|
762
|
-
cmd = "{}
|
|
776
|
+
cmd = f"{BACKCMD} delete -ep {endpoint} -tf {file}"
|
|
763
777
|
task = submit_globus_task(cmd, endpoint, logact)
|
|
764
778
|
if task['stat'] == 'S':
|
|
765
779
|
return PgLOG.SUCCESS
|
|
@@ -1028,7 +1042,7 @@ def move_backup_file(tofile, fromfile, endpoint = None, logact = 0):
|
|
|
1028
1042
|
elif tinfo != None:
|
|
1029
1043
|
return ret
|
|
1030
1044
|
|
|
1031
|
-
cmd = "{}
|
|
1045
|
+
cmd = f"{BACKCMD} rename -ep {endpoint} --old-path {fromfile} --new-path {tofile}"
|
|
1032
1046
|
loop = 0
|
|
1033
1047
|
while loop < 2:
|
|
1034
1048
|
buf = PgLOG.pgsystem(cmd, logact, CMDRET)
|
|
@@ -1158,7 +1172,7 @@ def make_one_backup_directory(dir, odir, endpoint = None, logact = 0):
|
|
|
1158
1172
|
if not odir: odir = dir
|
|
1159
1173
|
if not make_one_backup_directory(op.dirname(dir), odir, endpoint, logact): return PgLOG.FAILURE
|
|
1160
1174
|
|
|
1161
|
-
cmd = "{}
|
|
1175
|
+
cmd = f"{BACKCMD} mkdir -ep {endpoint} -p {dir}"
|
|
1162
1176
|
for loop in range(2):
|
|
1163
1177
|
buf = PgLOG.pgsystem(cmd, logact, CMDRET)
|
|
1164
1178
|
syserr = PgLOG.PGLOG['SYSERR']
|
|
@@ -1843,7 +1857,7 @@ def check_backup_file(file, endpoint = None, opt = 0, logact = 0):
|
|
|
1843
1857
|
if not endpoint: endpoint = PgLOG.PGLOG['BACKUPEP']
|
|
1844
1858
|
bdir = op.dirname(file)
|
|
1845
1859
|
bfile = op.basename(file)
|
|
1846
|
-
cmd = "{}
|
|
1860
|
+
cmd = f"{BACKCMD} ls -ep {endpoint} -p {bdir} --filter {bfile}"
|
|
1847
1861
|
ccnt = loop = 0
|
|
1848
1862
|
while loop < 2:
|
|
1849
1863
|
buf = PgLOG.pgsystem(cmd, logact, CMDRET)
|
|
@@ -2208,7 +2222,8 @@ def backup_glob(dir, endpoint = None, opt = 0, logact = 0):
|
|
|
2208
2222
|
|
|
2209
2223
|
if not dir: return None
|
|
2210
2224
|
if not endpoint: endpoint = PgLOG.PGLOG['BACKUPEP']
|
|
2211
|
-
|
|
2225
|
+
|
|
2226
|
+
cmd = f"{BACKCMD} ls -ep {endpoint} -p {dir}"
|
|
2212
2227
|
flist = {}
|
|
2213
2228
|
for loop in range(2):
|
|
2214
2229
|
buf = PgLOG.pgsystem(cmd, logact, CMDRET)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rda_python_common
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.21
|
|
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
|
|
@@ -12,6 +12,7 @@ Requires-Python: >=3.7
|
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
License-File: LICENSE
|
|
14
14
|
Requires-Dist: psycopg2-binary
|
|
15
|
+
Requires-Dist: rda-python-globus
|
|
15
16
|
Dynamic: license-file
|
|
16
17
|
|
|
17
18
|
# rda-python-common
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
rda_python_common/PgCMD.py,sha256=dsFL_hiAHRZ-BwncgZhxQ7p9O10ox9lUSXOIePjZ-PQ,20487
|
|
2
2
|
rda_python_common/PgDBI.py,sha256=iGy0SQZsdVbSz2ewTIUK3e-RQBC5eQM9-_XUcFU1c50,74211
|
|
3
|
-
rda_python_common/PgFile.py,sha256=
|
|
3
|
+
rda_python_common/PgFile.py,sha256=756onQnWH_MK8llF0-8b6yV6KC1eY_eCPEkygxeJQQU,98460
|
|
4
4
|
rda_python_common/PgLOG.py,sha256=DFCQgcmbU04H6Kz9X9nxuFdLA1VNRBQefRvK8LvO9Pw,54273
|
|
5
5
|
rda_python_common/PgLock.py,sha256=12i84nsGBuifSyPnm8IR63LvHvRuVU573D5QKFlHdOI,22623
|
|
6
6
|
rda_python_common/PgOPT.py,sha256=BAfuNi_1jEK-UyYVfPY_0f4b7KLhpcFM3BDShLRvT7w,55446
|
|
@@ -8,8 +8,8 @@ rda_python_common/PgSIG.py,sha256=oDXcSnnzW6wKm_cSpFxQZWAo2hpPPTcuNDYhPSNQcRc,35
|
|
|
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.21.dist-info/licenses/LICENSE,sha256=1dck4EAQwv8QweDWCXDx-4Or0S8YwiCstaso_H57Pno,1097
|
|
12
|
+
rda_python_common-1.0.21.dist-info/METADATA,sha256=aDnBKTHLFSlswpAfmoCtJ6aK_rbymOqV1PkG5b1zUnU,716
|
|
13
|
+
rda_python_common-1.0.21.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
|
14
|
+
rda_python_common-1.0.21.dist-info/top_level.txt,sha256=KVQmx7D3DD-jsiheqL8HdTrRE14hpRnZY5_ioMArA5k,18
|
|
15
|
+
rda_python_common-1.0.21.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|