kmisc 2.1.113__py3-none-any.whl → 2.1.115__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.
- kmisc/__init__.py +42 -13
- {kmisc-2.1.113.dist-info → kmisc-2.1.115.dist-info}/METADATA +1 -1
- kmisc-2.1.115.dist-info/RECORD +6 -0
- kmisc-2.1.113.dist-info/RECORD +0 -6
- {kmisc-2.1.113.dist-info → kmisc-2.1.115.dist-info}/LICENSE +0 -0
- {kmisc-2.1.113.dist-info → kmisc-2.1.115.dist-info}/WHEEL +0 -0
- {kmisc-2.1.113.dist-info → kmisc-2.1.115.dist-info}/top_level.txt +0 -0
kmisc/__init__.py
CHANGED
@@ -2076,9 +2076,11 @@ def findPlanCfg(filename,find_name=None,default=False,original=False,date=None):
|
|
2076
2076
|
data=cat(filename)
|
2077
2077
|
if data is False:
|
2078
2078
|
return default
|
2079
|
-
if find_name
|
2079
|
+
if find_name:
|
2080
|
+
if isinstance(find_name,str):
|
2081
|
+
find_name=find_name.split(',')
|
2080
2082
|
out=[]
|
2081
|
-
for ff in find_name
|
2083
|
+
for ff in find_name:
|
2082
2084
|
found=False
|
2083
2085
|
for i in data.split('\n'):
|
2084
2086
|
if isinstance(i,str) and '=' in i:
|
@@ -2733,24 +2735,51 @@ def net_start_single_server(server_port,main_func_name,server_ip='',timeout=0,ma
|
|
2733
2735
|
return rc
|
2734
2736
|
|
2735
2737
|
def kmp(mp={},func=None,name=None,timeout=0,quit=False,log_file=None,log_screen=True,log_raw=False, argv=[],queue=None):
|
2738
|
+
#Log
|
2739
|
+
def LLOG(msg):
|
2740
|
+
if 'log' in mp and 'queue' in mp['log']:
|
2741
|
+
mp['log']['queue'].put(msg)
|
2742
|
+
time.sleep(2)
|
2743
|
+
|
2736
2744
|
# Clean
|
2745
|
+
def terminate_process(pobj,max_retry=5):
|
2746
|
+
for i in range(max_retry):
|
2747
|
+
if isinstance(pobj,dict) and 'mp' in pobj:
|
2748
|
+
pobj=pobj['mp']
|
2749
|
+
if type(pobj).__name__ == 'Process':
|
2750
|
+
try:
|
2751
|
+
if pobj.is_alive():
|
2752
|
+
pobj.terminate()
|
2753
|
+
return True
|
2754
|
+
except:
|
2755
|
+
time.sleep(1)
|
2756
|
+
else:
|
2757
|
+
break
|
2758
|
+
return False
|
2759
|
+
|
2737
2760
|
for n in [k for k in mp]:
|
2738
2761
|
if quit is True:
|
2739
2762
|
if n != 'log':
|
2740
|
-
mp[n]['mp']
|
2741
|
-
|
2742
|
-
mp[
|
2763
|
+
if 'mp' in mp[n] and mp[n]['mp']:
|
2764
|
+
LLOG('\nterminate function {}'.format(n))
|
2765
|
+
if terminate_process(mp[n]):
|
2766
|
+
del mp[n]
|
2743
2767
|
else:
|
2744
2768
|
if mp[n]['timeout'] > 0 and TIME().Int() > mp[n]['timeout']:
|
2745
|
-
mp[n]
|
2746
|
-
|
2747
|
-
|
2748
|
-
|
2749
|
-
del mp[n]
|
2769
|
+
if 'mp' in mp[n]:
|
2770
|
+
if terminate_process(mp[n]['mp']):
|
2771
|
+
LLOG('\ntimeout function {}'.format(n))
|
2772
|
+
del mp[n]['mp']
|
2750
2773
|
if quit is True and 'log' in mp:
|
2751
|
-
|
2752
|
-
|
2753
|
-
|
2774
|
+
LLOG('\nterminate function log')
|
2775
|
+
if 'mp' in mp['log']:
|
2776
|
+
if terminate_process(mp['log']['mp']):
|
2777
|
+
del mp['log']['mp']
|
2778
|
+
if 'queue' in mp['log']:
|
2779
|
+
if terminate_process(mp['log']['queue']):
|
2780
|
+
del mp['log']['queue']
|
2781
|
+
if 'mp' not in mp['log'] and 'queue' not in mp['log']:
|
2782
|
+
del mp['log']
|
2754
2783
|
return
|
2755
2784
|
|
2756
2785
|
# LOG
|
@@ -0,0 +1,6 @@
|
|
1
|
+
kmisc/__init__.py,sha256=AQgeY0ISVrpu7EqQ7ubiPoveAiv4Y1bASBD-ZvpTtBM,138839
|
2
|
+
kmisc-2.1.115.dist-info/LICENSE,sha256=mn9ekhb34HJxsrVhcxrLXJUzy55T62zg-Gh9Ro0mVJI,1066
|
3
|
+
kmisc-2.1.115.dist-info/METADATA,sha256=FtlMmyiFOT7Is_eHJDNkcOV-quQ-RzOZabgtlkRfEZ0,5523
|
4
|
+
kmisc-2.1.115.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
|
5
|
+
kmisc-2.1.115.dist-info/top_level.txt,sha256=wvdHf5aQTqcGYvxk-F9E_BMWLMhlwC8INBmwO-V6_X4,6
|
6
|
+
kmisc-2.1.115.dist-info/RECORD,,
|
kmisc-2.1.113.dist-info/RECORD
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
kmisc/__init__.py,sha256=emQKkxfqVCMDcfAw_rK-V7R6pLQR4KyOK4pr4-FvtDU,137902
|
2
|
-
kmisc-2.1.113.dist-info/LICENSE,sha256=mn9ekhb34HJxsrVhcxrLXJUzy55T62zg-Gh9Ro0mVJI,1066
|
3
|
-
kmisc-2.1.113.dist-info/METADATA,sha256=G8rSKNOZ5bCu0lv63QiG3ZlqzXxIABUx0wmaK2CxYuw,5523
|
4
|
-
kmisc-2.1.113.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
|
5
|
-
kmisc-2.1.113.dist-info/top_level.txt,sha256=wvdHf5aQTqcGYvxk-F9E_BMWLMhlwC8INBmwO-V6_X4,6
|
6
|
-
kmisc-2.1.113.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|