rda-python-common 1.0.18__tar.gz → 1.0.21__tar.gz

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.

Files changed (22) hide show
  1. {rda_python_common-1.0.18 → rda_python_common-1.0.21}/PKG-INFO +2 -1
  2. {rda_python_common-1.0.18 → rda_python_common-1.0.21}/pyproject.toml +3 -2
  3. {rda_python_common-1.0.18 → rda_python_common-1.0.21}/src/rda_python_common/PgFile.py +33 -18
  4. {rda_python_common-1.0.18 → rda_python_common-1.0.21}/src/rda_python_common.egg-info/PKG-INFO +2 -1
  5. rda_python_common-1.0.21/src/rda_python_common.egg-info/requires.txt +2 -0
  6. rda_python_common-1.0.18/src/rda_python_common.egg-info/requires.txt +0 -1
  7. {rda_python_common-1.0.18 → rda_python_common-1.0.21}/LICENSE +0 -0
  8. {rda_python_common-1.0.18 → rda_python_common-1.0.21}/README.md +0 -0
  9. {rda_python_common-1.0.18 → rda_python_common-1.0.21}/setup.cfg +0 -0
  10. {rda_python_common-1.0.18 → rda_python_common-1.0.21}/src/rda_python_common/PgCMD.py +0 -0
  11. {rda_python_common-1.0.18 → rda_python_common-1.0.21}/src/rda_python_common/PgDBI.py +0 -0
  12. {rda_python_common-1.0.18 → rda_python_common-1.0.21}/src/rda_python_common/PgLOG.py +0 -0
  13. {rda_python_common-1.0.18 → rda_python_common-1.0.21}/src/rda_python_common/PgLock.py +0 -0
  14. {rda_python_common-1.0.18 → rda_python_common-1.0.21}/src/rda_python_common/PgOPT.py +0 -0
  15. {rda_python_common-1.0.18 → rda_python_common-1.0.21}/src/rda_python_common/PgSIG.py +0 -0
  16. {rda_python_common-1.0.18 → rda_python_common-1.0.21}/src/rda_python_common/PgSplit.py +0 -0
  17. {rda_python_common-1.0.18 → rda_python_common-1.0.21}/src/rda_python_common/PgUtil.py +0 -0
  18. {rda_python_common-1.0.18 → rda_python_common-1.0.21}/src/rda_python_common/__init__.py +0 -0
  19. {rda_python_common-1.0.18 → rda_python_common-1.0.21}/src/rda_python_common.egg-info/SOURCES.txt +0 -0
  20. {rda_python_common-1.0.18 → rda_python_common-1.0.21}/src/rda_python_common.egg-info/dependency_links.txt +0 -0
  21. {rda_python_common-1.0.18 → rda_python_common-1.0.21}/src/rda_python_common.egg-info/top_level.txt +0 -0
  22. {rda_python_common-1.0.18 → rda_python_common-1.0.21}/test/test_common.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rda_python_common
3
- Version: 1.0.18
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
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "rda_python_common"
7
- version = "1.0.18"
7
+ version = "1.0.21"
8
8
  authors = [
9
9
  { name="Zaihua Ji", email="zji@ucar.edu" },
10
10
  ]
@@ -18,7 +18,8 @@ classifiers = [
18
18
  "Development Status :: 5 - Production/Stable",
19
19
  ]
20
20
  dependencies = [
21
- "psycopg2-binary"
21
+ "psycopg2-binary",
22
+ "rda-python-globus",
22
23
  ]
23
24
 
24
25
  [project.urls]
@@ -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
- qstr = '{"action":"transfer","label":"%s","verify_checksum":true,' % ENDPOINTS[topoint]
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
- bstr = ''
343
+ transfer_files = {"files": []}
346
344
  for i in range(fcnt):
347
- qstr += '%s{"source_file":"%s","destination_file":"%s"}' % (bstr, fromfiles[i], tofiles[i])
348
- if i == 0: bstr = ',\n'
349
- qstr += ']}'
350
-
351
- task = submit_globus_task(BACKCMD, topoint, logact, qstr)
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
- cmd = "{} -t -vc -se {} -de {} -sf {} -df {}".format(BACKCMD, frompoint, topoint, fromfile, tofile)
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
- cmd = "{} -gt --task-id {}".format(BACKCMD, taskid)
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 = "{} -ct --task-id {}".format(BACKCMD, taskid)
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 = "{} -d -ep {} -tf {}".format(BACKCMD, endpoint, file)
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 = "{} --rename -ep {} --oldpath {} --newpath {}".format(BACKCMD, endpoint, fromfile, tofile)
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 = "{} --mkdir -ep {} -p {}".format(BACKCMD, endpoint, dir)
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 = "{} -ls -ep {} -p {} --filter {}".format(BACKCMD, endpoint, bdir, bfile)
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
- cmd = "{} -ls -ep {} -p {}".format(BACKCMD, endpoint, dir)
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.18
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
@@ -0,0 +1,2 @@
1
+ psycopg2-binary
2
+ rda-python-globus
@@ -1 +0,0 @@
1
- psycopg2-binary