rda-python-common 3.0.13__tar.gz → 3.0.15__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.
- {rda_python_common-3.0.13/src/rda_python_common.egg-info → rda_python_common-3.0.15}/PKG-INFO +2 -2
- {rda_python_common-3.0.13 → rda_python_common-3.0.15}/README.md +1 -1
- {rda_python_common-3.0.13 → rda_python_common-3.0.15}/pyproject.toml +1 -1
- {rda_python_common-3.0.13 → rda_python_common-3.0.15}/src/rda_python_common/PgCMD.py +11 -19
- {rda_python_common-3.0.13 → rda_python_common-3.0.15}/src/rda_python_common/PgDBI.py +126 -263
- {rda_python_common-3.0.13 → rda_python_common-3.0.15}/src/rda_python_common/PgFile.py +128 -178
- {rda_python_common-3.0.13 → rda_python_common-3.0.15}/src/rda_python_common/PgLOG.py +162 -321
- {rda_python_common-3.0.13 → rda_python_common-3.0.15}/src/rda_python_common/PgLock.py +9 -12
- {rda_python_common-3.0.13 → rda_python_common-3.0.15}/src/rda_python_common/PgOPT.py +31 -49
- {rda_python_common-3.0.13 → rda_python_common-3.0.15}/src/rda_python_common/PgSIG.py +159 -311
- {rda_python_common-3.0.13 → rda_python_common-3.0.15}/src/rda_python_common/PgSplit.py +30 -41
- {rda_python_common-3.0.13 → rda_python_common-3.0.15}/src/rda_python_common/PgUtil.py +104 -232
- {rda_python_common-3.0.13 → rda_python_common-3.0.15}/src/rda_python_common/__init__.py +1 -1
- {rda_python_common-3.0.13 → rda_python_common-3.0.15}/src/rda_python_common/pg_dbi.py +111 -23
- {rda_python_common-3.0.13 → rda_python_common-3.0.15}/src/rda_python_common/pg_log.py +2 -2
- {rda_python_common-3.0.13 → rda_python_common-3.0.15}/src/rda_python_common/pg_util.py +1 -1
- {rda_python_common-3.0.13 → rda_python_common-3.0.15/src/rda_python_common.egg-info}/PKG-INFO +2 -2
- {rda_python_common-3.0.13 → rda_python_common-3.0.15}/LICENSE +0 -0
- {rda_python_common-3.0.13 → rda_python_common-3.0.15}/setup.cfg +0 -0
- {rda_python_common-3.0.13 → rda_python_common-3.0.15}/src/rda_python_common/pg_cmd.py +0 -0
- {rda_python_common-3.0.13 → rda_python_common-3.0.15}/src/rda_python_common/pg_file.py +0 -0
- {rda_python_common-3.0.13 → rda_python_common-3.0.15}/src/rda_python_common/pg_lock.py +0 -0
- {rda_python_common-3.0.13 → rda_python_common-3.0.15}/src/rda_python_common/pg_opt.py +0 -0
- {rda_python_common-3.0.13 → rda_python_common-3.0.15}/src/rda_python_common/pg_password.py +0 -0
- {rda_python_common-3.0.13 → rda_python_common-3.0.15}/src/rda_python_common/pg_sig.py +0 -0
- {rda_python_common-3.0.13 → rda_python_common-3.0.15}/src/rda_python_common/pg_split.py +0 -0
- {rda_python_common-3.0.13 → rda_python_common-3.0.15}/src/rda_python_common/pgpassword.py +0 -0
- {rda_python_common-3.0.13 → rda_python_common-3.0.15}/src/rda_python_common/pgpassword.usg +0 -0
- {rda_python_common-3.0.13 → rda_python_common-3.0.15}/src/rda_python_common.egg-info/SOURCES.txt +0 -0
- {rda_python_common-3.0.13 → rda_python_common-3.0.15}/src/rda_python_common.egg-info/dependency_links.txt +0 -0
- {rda_python_common-3.0.13 → rda_python_common-3.0.15}/src/rda_python_common.egg-info/entry_points.txt +0 -0
- {rda_python_common-3.0.13 → rda_python_common-3.0.15}/src/rda_python_common.egg-info/requires.txt +0 -0
- {rda_python_common-3.0.13 → rda_python_common-3.0.15}/src/rda_python_common.egg-info/top_level.txt +0 -0
- {rda_python_common-3.0.13 → rda_python_common-3.0.15}/test/test_common.py +0 -0
{rda_python_common-3.0.13/src/rda_python_common.egg-info → rda_python_common-3.0.15}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rda_python_common
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.15
|
|
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
|
|
@@ -189,7 +189,7 @@ PgLOG.pglog("hello", PgLOG.LOGWRN)
|
|
|
189
189
|
python -c "import rda_python_common; print(rda_python_common.__version__)"
|
|
190
190
|
```
|
|
191
191
|
|
|
192
|
-
You should see the installed version (currently `3.0.
|
|
192
|
+
You should see the installed version (currently `3.0.15`). If the import
|
|
193
193
|
fails, double-check that the active Python environment is the one where you
|
|
194
194
|
ran `pip install`.
|
|
195
195
|
|
|
@@ -165,7 +165,7 @@ PgLOG.pglog("hello", PgLOG.LOGWRN)
|
|
|
165
165
|
python -c "import rda_python_common; print(rda_python_common.__version__)"
|
|
166
166
|
```
|
|
167
167
|
|
|
168
|
-
You should see the installed version (currently `3.0.
|
|
168
|
+
You should see the installed version (currently `3.0.15`). If the import
|
|
169
169
|
fails, double-check that the active Python environment is the one where you
|
|
170
170
|
ran `pip install`.
|
|
171
171
|
|
|
@@ -133,26 +133,21 @@ def get_delay_options(doptions, cmd):
|
|
|
133
133
|
#
|
|
134
134
|
# find an existing dscheck record from the cached command argument; create and initialize one if not exist
|
|
135
135
|
#
|
|
136
|
-
def init_dscheck(oindex, otype, cmd, dsid, action, workdir
|
|
137
|
-
|
|
136
|
+
def init_dscheck(oindex, otype, cmd, dsid, action, workdir=None, specialist=None, doptions=None, logact=0):
|
|
138
137
|
cidx = 0
|
|
139
138
|
argv = PgLOG.argv_to_string(sys.argv[1:], 0, "Process in Delayed Mode")
|
|
140
139
|
argextra = None
|
|
141
|
-
|
|
142
140
|
if not logact: logact = PgLOG.LGEREX
|
|
143
141
|
if not workdir: workdir = os.getcwd()
|
|
144
142
|
if not specialist: specialist = PgLOG.PGLOG['CURUID']
|
|
145
|
-
|
|
146
143
|
(mcount, hosts) = get_delay_options(doptions, cmd)
|
|
147
|
-
|
|
148
144
|
if len(argv) > 100:
|
|
149
145
|
argextra = argv[100:]
|
|
150
146
|
argv = argv[0:100]
|
|
151
|
-
|
|
152
147
|
bck = PgLOG.PGLOG['BCKGRND']
|
|
153
148
|
PgLOG.PGLOG['BCKGRND'] = 0
|
|
154
149
|
cinfo = "{}-{}-Chk".format(PgLOG.PGLOG['HOSTNAME'], PgLOG.current_datetime())
|
|
155
|
-
pgrec = get_dscheck(cmd, argv, workdir, specialist, argextra, logact)
|
|
150
|
+
pgrec = get_dscheck(cmd, argv, workdir, specialist, argextra, logact)
|
|
156
151
|
if pgrec: # found existing dscheck record
|
|
157
152
|
cidx = pgrec['cindex']
|
|
158
153
|
cmsg = "{}{}: {} batch process ".format(cinfo, cidx, get_command_info(pgrec))
|
|
@@ -171,10 +166,9 @@ def init_dscheck(oindex, otype, cmd, dsid, action, workdir = None, specialist =
|
|
|
171
166
|
PgLOG.pglog("{}is {}".format(cmsg, ('Done' if pgrec['status'] == 'D' else 'Finished')), PgLOG.LOGWRN)
|
|
172
167
|
PgLock.lock_dscheck(cidx, 0, logact)
|
|
173
168
|
sys.exit(0)
|
|
174
|
-
|
|
175
169
|
if not cidx: # add new dscheck record
|
|
176
170
|
record = {}
|
|
177
|
-
if hosts and re.match(r'
|
|
171
|
+
if hosts and re.match(r'^\w\d\d\d\d\d\d$', hosts):
|
|
178
172
|
PgLOG.pglog(hosts + ": Cannot pass DSID for hostname to submit batch process", PgLOG.LGEREX)
|
|
179
173
|
if oindex: set_command_control(oindex, otype, cmd, logact)
|
|
180
174
|
record['oindex'] = oindex
|
|
@@ -219,7 +213,6 @@ def init_dscheck(oindex, otype, cmd, dsid, action, workdir = None, specialist =
|
|
|
219
213
|
if pgrec['command'] == "dsrqst" and pgrec['oindex']:
|
|
220
214
|
(record['fcount'], record['dcount'], record['size']) = get_dsrqst_counts(pgrec, logact)
|
|
221
215
|
PgDBI.pgupdt("dscheck", record, DSCHK['chkcnd'], logact)
|
|
222
|
-
|
|
223
216
|
DSCHK['dcount'] = pgrec['dcount']
|
|
224
217
|
DSCHK['fcount'] = pgrec['fcount']
|
|
225
218
|
DSCHK['size'] = pgrec['size']
|
|
@@ -234,7 +227,6 @@ def init_dscheck(oindex, otype, cmd, dsid, action, workdir = None, specialist =
|
|
|
234
227
|
if rhost != chost: pstr += "/{}<{}>".format(rhost, rpid)
|
|
235
228
|
PgLOG.pglog("{}Starts {} ({})".format(cmsg, tstr, pstr), PgLOG.LOGWRN)
|
|
236
229
|
PgLOG.PGLOG['BCKGRND'] = bck
|
|
237
|
-
|
|
238
230
|
return cidx
|
|
239
231
|
|
|
240
232
|
#
|
|
@@ -318,17 +310,17 @@ def get_partition_control(pgpart, pgrqst = None, pgctl = None, logact = 0):
|
|
|
318
310
|
#
|
|
319
311
|
# build the dynamic options
|
|
320
312
|
#
|
|
321
|
-
def get_dynamic_options(cmd, oindex, otype):
|
|
322
|
-
|
|
323
|
-
if
|
|
324
|
-
if
|
|
313
|
+
def get_dynamic_options(cmd, oindex, otype, hostname=None):
|
|
314
|
+
if oindex: cmd += " {}".format(oindex)
|
|
315
|
+
if otype: cmd += ' ' + otype
|
|
316
|
+
if hostname: cmd = "ssh {} {}".format(hostname, PgLOG.command_path(cmd))
|
|
325
317
|
ret = options = ''
|
|
326
318
|
for loop in range(3):
|
|
327
|
-
ret = PgLOG.pgsystem(cmd, PgLOG.LOGWRN,
|
|
319
|
+
ret = PgLOG.pgsystem(cmd, PgLOG.LOGWRN, 1299) # 1+2+16+256+1024
|
|
328
320
|
if loop < 2 and PgLOG.PGLOG['SYSERR'] and 'Connection timed out' in PgLOG.PGLOG['SYSERR']:
|
|
329
321
|
time.sleep(PgSIG.PGSIG['ETIME'])
|
|
330
322
|
else:
|
|
331
|
-
break
|
|
323
|
+
break
|
|
332
324
|
if ret:
|
|
333
325
|
ret = ret.strip()
|
|
334
326
|
ms = re.match(r'^(-.+)/(-.+)$', ret)
|
|
@@ -337,8 +329,8 @@ def get_dynamic_options(cmd, oindex, otype):
|
|
|
337
329
|
elif re.match(r'^(-.+)$', ret):
|
|
338
330
|
options = ret
|
|
339
331
|
if not options:
|
|
340
|
-
if ret: PgLOG.PGLOG['SYSERR']
|
|
341
|
-
PgLOG.PGLOG['SYSERR']
|
|
332
|
+
if ret: PgLOG.PGLOG['SYSERR'] = (PgLOG.PGLOG['SYSERR'] or '') + ret
|
|
333
|
+
PgLOG.PGLOG['SYSERR'] = (PgLOG.PGLOG['SYSERR'] or '') + " for {}".format(cmd)
|
|
342
334
|
|
|
343
335
|
return options
|
|
344
336
|
|