rda-python-common 3.0.28__tar.gz → 3.0.29__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.28/src/rda_python_common.egg-info → rda_python_common-3.0.29}/PKG-INFO +2 -2
- {rda_python_common-3.0.28 → rda_python_common-3.0.29}/README.md +1 -1
- {rda_python_common-3.0.28 → rda_python_common-3.0.29}/pyproject.toml +1 -1
- {rda_python_common-3.0.28 → rda_python_common-3.0.29}/src/rda_python_common/__init__.py +1 -1
- {rda_python_common-3.0.28 → rda_python_common-3.0.29}/src/rda_python_common/pg_sig.py +41 -6
- {rda_python_common-3.0.28 → rda_python_common-3.0.29/src/rda_python_common.egg-info}/PKG-INFO +2 -2
- {rda_python_common-3.0.28 → rda_python_common-3.0.29}/LICENSE +0 -0
- {rda_python_common-3.0.28 → rda_python_common-3.0.29}/setup.cfg +0 -0
- {rda_python_common-3.0.28 → rda_python_common-3.0.29}/src/rda_python_common/PgCMD.py +0 -0
- {rda_python_common-3.0.28 → rda_python_common-3.0.29}/src/rda_python_common/PgDBI.py +0 -0
- {rda_python_common-3.0.28 → rda_python_common-3.0.29}/src/rda_python_common/PgFile.py +0 -0
- {rda_python_common-3.0.28 → rda_python_common-3.0.29}/src/rda_python_common/PgLOG.py +0 -0
- {rda_python_common-3.0.28 → rda_python_common-3.0.29}/src/rda_python_common/PgLock.py +0 -0
- {rda_python_common-3.0.28 → rda_python_common-3.0.29}/src/rda_python_common/PgOPT.py +0 -0
- {rda_python_common-3.0.28 → rda_python_common-3.0.29}/src/rda_python_common/PgSIG.py +0 -0
- {rda_python_common-3.0.28 → rda_python_common-3.0.29}/src/rda_python_common/PgSplit.py +0 -0
- {rda_python_common-3.0.28 → rda_python_common-3.0.29}/src/rda_python_common/PgUtil.py +0 -0
- {rda_python_common-3.0.28 → rda_python_common-3.0.29}/src/rda_python_common/pg_cmd.py +0 -0
- {rda_python_common-3.0.28 → rda_python_common-3.0.29}/src/rda_python_common/pg_dbi.py +0 -0
- {rda_python_common-3.0.28 → rda_python_common-3.0.29}/src/rda_python_common/pg_file.py +0 -0
- {rda_python_common-3.0.28 → rda_python_common-3.0.29}/src/rda_python_common/pg_lock.py +0 -0
- {rda_python_common-3.0.28 → rda_python_common-3.0.29}/src/rda_python_common/pg_log.py +0 -0
- {rda_python_common-3.0.28 → rda_python_common-3.0.29}/src/rda_python_common/pg_opt.py +0 -0
- {rda_python_common-3.0.28 → rda_python_common-3.0.29}/src/rda_python_common/pg_password.py +0 -0
- {rda_python_common-3.0.28 → rda_python_common-3.0.29}/src/rda_python_common/pg_split.py +0 -0
- {rda_python_common-3.0.28 → rda_python_common-3.0.29}/src/rda_python_common/pg_util.py +0 -0
- {rda_python_common-3.0.28 → rda_python_common-3.0.29}/src/rda_python_common/pgpassword.py +0 -0
- {rda_python_common-3.0.28 → rda_python_common-3.0.29}/src/rda_python_common/pgpassword.usg +0 -0
- {rda_python_common-3.0.28 → rda_python_common-3.0.29}/src/rda_python_common.egg-info/SOURCES.txt +0 -0
- {rda_python_common-3.0.28 → rda_python_common-3.0.29}/src/rda_python_common.egg-info/dependency_links.txt +0 -0
- {rda_python_common-3.0.28 → rda_python_common-3.0.29}/src/rda_python_common.egg-info/entry_points.txt +0 -0
- {rda_python_common-3.0.28 → rda_python_common-3.0.29}/src/rda_python_common.egg-info/requires.txt +0 -0
- {rda_python_common-3.0.28 → rda_python_common-3.0.29}/src/rda_python_common.egg-info/top_level.txt +0 -0
- {rda_python_common-3.0.28 → rda_python_common-3.0.29}/test/test_common.py +0 -0
{rda_python_common-3.0.28/src/rda_python_common.egg-info → rda_python_common-3.0.29}/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.29
|
|
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.29`). 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.29`). 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
|
|
|
@@ -52,7 +52,11 @@ class PgSIG(PgDBI):
|
|
|
52
52
|
'MPROC': 1, # default number of multiple processes
|
|
53
53
|
'BPROC': 1, # default number of multiple background processes
|
|
54
54
|
'ETIME': 20, # default error waiting time (in seconds)
|
|
55
|
-
'WTIME': 120, # default waiting time (in seconds)
|
|
55
|
+
'WTIME': 120, # default waiting time (in seconds), the cap of an adaptive wait
|
|
56
|
+
'WTMIN': 5, # shortest adaptive wait (in seconds) for child/background processes
|
|
57
|
+
'WTINC': 5, # seconds added to the adaptive wait after each loop still waiting
|
|
58
|
+
'CWTIME': 0, # current adaptive wait (in seconds), 0 before the first wait
|
|
59
|
+
'WLOOP': -1, # loop count of the last adaptive wait sleep
|
|
56
60
|
'DTIME': 600, # the daemon record refresh time (in seconds)
|
|
57
61
|
'RTIME': 2400, # the web rda config unlocking and unconfigured system down waiting time (in seconds)
|
|
58
62
|
'CTIME': 4800, # the lock cleaning & configued system down waiting time (in seconds)
|
|
@@ -1281,21 +1285,52 @@ class PgSIG(PgDBI):
|
|
|
1281
1285
|
if wtime: time.sleep(wtime)
|
|
1282
1286
|
return wtime
|
|
1283
1287
|
|
|
1284
|
-
# show wait message every
|
|
1288
|
+
# show wait message every 30 loops and then sleep for an adaptive wait time
|
|
1285
1289
|
def show_wait_message(self, loop, msg, logact=None, dowait=0):
|
|
1286
1290
|
"""Log a wait message every 30 loops and optionally sleep.
|
|
1287
1291
|
|
|
1288
1292
|
Args:
|
|
1289
|
-
loop (int): Current loop iteration count.
|
|
1293
|
+
loop (int): Current loop iteration count, 0 for the first sleep of a wait.
|
|
1290
1294
|
msg (str): Message to log.
|
|
1291
1295
|
logact (int, optional): Log action flags. Defaults to ``LOGWRN``.
|
|
1292
|
-
dowait (int, optional): If non-zero, sleep for
|
|
1293
|
-
|
|
1296
|
+
dowait (int, optional): If non-zero, sleep for the adaptive wait time
|
|
1297
|
+
from ``adaptive_wait_time()``, at most ``PGSIG['WTIME']`` seconds.
|
|
1298
|
+
Defaults to 0.
|
|
1294
1299
|
"""
|
|
1295
1300
|
if logact is None: logact = self.LOGWRN
|
|
1296
1301
|
if loop > 0 and (loop%30) == 0:
|
|
1297
1302
|
self.pglog("{} at {}".format(msg, self.current_datetime()), logact)
|
|
1298
|
-
if dowait: time.sleep(self.
|
|
1303
|
+
if dowait: time.sleep(self.adaptive_wait_time(loop))
|
|
1304
|
+
|
|
1305
|
+
# get the adaptive time to sleep for one loop of a wait for processes
|
|
1306
|
+
def adaptive_wait_time(self, loop):
|
|
1307
|
+
"""Return how long to sleep for one loop of a wait for child/background processes.
|
|
1308
|
+
|
|
1309
|
+
The wait starts at ``PGSIG['WTMIN']`` seconds and grows by ``PGSIG['WTINC']``
|
|
1310
|
+
after each loop that still finds no process done, capped at the polling time
|
|
1311
|
+
``PGSIG['WTIME']``, so long-running processes are not checked too often while
|
|
1312
|
+
short ones are not waited on for the full polling time. The current wait
|
|
1313
|
+
carries over to the next wait; it goes back to ``WTMIN`` when the previous
|
|
1314
|
+
wait was over after its first sleep, since the processes are short. Set
|
|
1315
|
+
``PGSIG['WTMIN']`` to ``WTIME`` or larger for the old fixed wait.
|
|
1316
|
+
|
|
1317
|
+
Args:
|
|
1318
|
+
loop (int): Loop count of the current wait, 0 for its first sleep.
|
|
1319
|
+
|
|
1320
|
+
Returns:
|
|
1321
|
+
int: Seconds to sleep.
|
|
1322
|
+
"""
|
|
1323
|
+
wmax = self.PGSIG['WTIME']
|
|
1324
|
+
wmin = min(self.PGSIG['WTMIN'], wmax)
|
|
1325
|
+
wtime = self.PGSIG['CWTIME']
|
|
1326
|
+
if loop == 0:
|
|
1327
|
+
if not wtime or self.PGSIG['WLOOP'] == 0: wtime = wmin
|
|
1328
|
+
else:
|
|
1329
|
+
wtime += self.PGSIG['WTINC']
|
|
1330
|
+
wtime = max(wmin, min(wtime, wmax))
|
|
1331
|
+
self.PGSIG['CWTIME'] = wtime
|
|
1332
|
+
self.PGSIG['WLOOP'] = loop
|
|
1333
|
+
return wtime
|
|
1299
1334
|
|
|
1300
1335
|
# register a time out function to raise a time out error
|
|
1301
1336
|
@contextmanager
|
{rda_python_common-3.0.28 → rda_python_common-3.0.29/src/rda_python_common.egg-info}/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.29
|
|
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.29`). 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
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rda_python_common-3.0.28 → rda_python_common-3.0.29}/src/rda_python_common.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rda_python_common-3.0.28 → rda_python_common-3.0.29}/src/rda_python_common.egg-info/requires.txt
RENAMED
|
File without changes
|
{rda_python_common-3.0.28 → rda_python_common-3.0.29}/src/rda_python_common.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|