kcwebs 3.21__tar.gz → 3.23__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.
- {kcwebs-3.21 → kcwebs-3.23}/PKG-INFO +2 -2
- {kcwebs-3.21 → kcwebs-3.23}/kcwebs/__init__.py +1 -1
- {kcwebs-3.21 → kcwebs-3.23}/kcwebs/utill/queues.py +101 -7
- {kcwebs-3.21 → kcwebs-3.23}/kcwebs.egg-info/PKG-INFO +2 -2
- {kcwebs-3.21 → kcwebs-3.23}/kcwebs.egg-info/requires.txt +4 -4
- {kcwebs-3.21 → kcwebs-3.23}/README.md +0 -0
- {kcwebs-3.21 → kcwebs-3.23}/kcwebs/common/__init__.py +0 -0
- {kcwebs-3.21 → kcwebs-3.23}/kcwebs/common/autoload.py +0 -0
- {kcwebs-3.21 → kcwebs-3.23}/kcwebs/common/session.py +0 -0
- {kcwebs-3.21 → kcwebs-3.23}/kcwebs/config/__init__.py +0 -0
- {kcwebs-3.21 → kcwebs-3.23}/kcwebs/kcwebs.py +0 -0
- {kcwebs-3.21 → kcwebs-3.23}/kcwebs/tempfile/kcwebs/app/__init__.py +0 -0
- {kcwebs-3.21 → kcwebs-3.23}/kcwebs/tempfile/kcwebs/app/api/__init__.py +0 -0
- {kcwebs-3.21 → kcwebs-3.23}/kcwebs/tempfile/kcwebs/app/api/common/__init__.py +0 -0
- {kcwebs-3.21 → kcwebs-3.23}/kcwebs/tempfile/kcwebs/app/api/common/autoload.py +0 -0
- {kcwebs-3.21 → kcwebs-3.23}/kcwebs/tempfile/kcwebs/app/api/controller/__init__.py +0 -0
- {kcwebs-3.21 → kcwebs-3.23}/kcwebs/tempfile/kcwebs/app/api/controller/index/__init__.py +0 -0
- {kcwebs-3.21 → kcwebs-3.23}/kcwebs/tempfile/kcwebs/app/api/controller/index/common/__init__.py +0 -0
- {kcwebs-3.21 → kcwebs-3.23}/kcwebs/tempfile/kcwebs/app/api/controller/index/common/autoload.py +0 -0
- {kcwebs-3.21 → kcwebs-3.23}/kcwebs/tempfile/kcwebs/app/api/controller/index/common/html/include/static.html +0 -0
- {kcwebs-3.21 → kcwebs-3.23}/kcwebs/tempfile/kcwebs/app/api/controller/index/common/model.py +0 -0
- {kcwebs-3.21 → kcwebs-3.23}/kcwebs/tempfile/kcwebs/app/api/controller/index/index.py +0 -0
- {kcwebs-3.21 → kcwebs-3.23}/kcwebs/tempfile/kcwebs/app/api/controller/index/tpl/index/home.html +0 -0
- {kcwebs-3.21 → kcwebs-3.23}/kcwebs/tempfile/kcwebs/app/api/controller/index/tpl/index/index.html +0 -0
- {kcwebs-3.21 → kcwebs-3.23}/kcwebs/tempfile/kcwebs/app/common/__init__.py +0 -0
- {kcwebs-3.21 → kcwebs-3.23}/kcwebs/tempfile/kcwebs/app/common/autoload.py +0 -0
- {kcwebs-3.21 → kcwebs-3.23}/kcwebs/tempfile/kcwebs/app/common/html/include/static.html +0 -0
- {kcwebs-3.21 → kcwebs-3.23}/kcwebs/tempfile/kcwebs/app/common/model.py +0 -0
- {kcwebs-3.21 → kcwebs-3.23}/kcwebs/tempfile/kcwebs/app/config/__init__.py +0 -0
- {kcwebs-3.21 → kcwebs-3.23}/kcwebs/tempfile/kcwebs/app/config/app.py +0 -0
- {kcwebs-3.21 → kcwebs-3.23}/kcwebs/tempfile/kcwebs/app/config/database.py +0 -0
- {kcwebs-3.21 → kcwebs-3.23}/kcwebs/tempfile/kcwebs/app/config/other.py +0 -0
- {kcwebs-3.21 → kcwebs-3.23}/kcwebs/tempfile/kcwebs/app/config/redis.py +0 -0
- {kcwebs-3.21 → kcwebs-3.23}/kcwebs/tempfile/kcwebs/server.py +0 -0
- {kcwebs-3.21 → kcwebs-3.23}/kcwebs/utill/db/model.py +0 -0
- {kcwebs-3.21 → kcwebs-3.23}/kcwebs/utill/db/mongodb.py +0 -0
- {kcwebs-3.21 → kcwebs-3.23}/kcwebs.egg-info/SOURCES.txt +0 -0
- {kcwebs-3.21 → kcwebs-3.23}/kcwebs.egg-info/dependency_links.txt +0 -0
- {kcwebs-3.21 → kcwebs-3.23}/kcwebs.egg-info/entry_points.txt +0 -0
- {kcwebs-3.21 → kcwebs-3.23}/kcwebs.egg-info/top_level.txt +0 -0
- {kcwebs-3.21 → kcwebs-3.23}/setup.cfg +0 -0
- {kcwebs-3.21 → kcwebs-3.23}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 1.2
|
|
2
2
|
Name: kcwebs
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.23
|
|
4
4
|
Summary: kcwebs作为web开发而设计的高性能框架
|
|
5
5
|
Home-page: https://docs.kwebapp.cn/index/index/2
|
|
6
6
|
Author: 百里-坤坤
|
|
@@ -9,5 +9,5 @@ Maintainer: 坤坤
|
|
|
9
9
|
Maintainer-email: fk1402936534@qq.com
|
|
10
10
|
License: MIT License
|
|
11
11
|
Description: kcwebs作为web开发而设计的高性能框架,采用全新的架构思想,注重易用性。遵循MIT开源许可协议发布,意味着个人和企业可以免费使用kcwebs,甚至允许把你基于kcwebs开发的应用开源或商业产品发布或销售。完整文档请访问:https://docs.kwebapp.cn/index/index/2
|
|
12
|
-
Keywords: kcwebs3.
|
|
12
|
+
Keywords: kcwebs3.23
|
|
13
13
|
Platform: UNKNOWN
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
from queue import Queue
|
|
2
2
|
from .db import model
|
|
3
|
-
# from .db import sqlite as kcwssqlite
|
|
4
3
|
import threading,time,os,hashlib,random,traceback,multiprocessing,kcwsqlite
|
|
5
4
|
queuesdbpath=os.path.split(os.path.realpath(__file__))[0]+"/Queues"
|
|
6
5
|
class model_kcwebs_task(model.model):
|
|
@@ -39,6 +38,53 @@ class Queues():
|
|
|
39
38
|
Queues.__globalqueue=Queue()
|
|
40
39
|
t=threading.Thread(target=Queues.__messagequeue,daemon=True)
|
|
41
40
|
t.start()
|
|
41
|
+
__scripttask=None
|
|
42
|
+
__scripttasklist=[]
|
|
43
|
+
def __script():
|
|
44
|
+
if not Queues.__scripttask:
|
|
45
|
+
if not os.path.isfile(queuesdbpath):
|
|
46
|
+
model_kcwebs_tasks=model_kcwebs_task()
|
|
47
|
+
model_kcwebs_tasks.create_table()
|
|
48
|
+
try:
|
|
49
|
+
kcwsqlite.sqlite.connect(queuesdbpath,th_lock=True).table("model_kcwebs_queues").find()
|
|
50
|
+
except:
|
|
51
|
+
model_kcwebs_tasks=model_kcwebs_task()
|
|
52
|
+
model_kcwebs_tasks.create_table()
|
|
53
|
+
Queues.__scripttask=Queue()
|
|
54
|
+
t=threading.Thread(target=Queues.__taskmessagequeue,daemon=True)
|
|
55
|
+
t.start()
|
|
56
|
+
t=threading.Thread(target=Queues.__taskmessagequeue_zx,daemon=True)
|
|
57
|
+
t.start()
|
|
58
|
+
|
|
59
|
+
def __taskmessagequeue_zx():
|
|
60
|
+
time.sleep(10)
|
|
61
|
+
while True:
|
|
62
|
+
for value in Queues.__scripttasklist:
|
|
63
|
+
kcwsqlite.sqlite.connect(queuesdbpath,th_lock=True).table("model_kcwebs_queues").where("taskid = '"+value['task']['taskid']+"' and code!=4").update({"code":3,"error":""})
|
|
64
|
+
if value['args']:
|
|
65
|
+
try:
|
|
66
|
+
value['target'](*value['args'])
|
|
67
|
+
except:
|
|
68
|
+
kcwsqlite.sqlite.connect(queuesdbpath,th_lock=True).table("model_kcwebs_queues").where("taskid = '"+value['task']['taskid']+"' and code!=4").update({"code":1,'endtime':int(time.time()),'updtime':int(time.time()),"error":str(traceback.format_exc())})
|
|
69
|
+
else:
|
|
70
|
+
kcwsqlite.sqlite.connect(queuesdbpath,th_lock=True).table("model_kcwebs_queues").where("taskid = '"+value['task']['taskid']+"' and code!=4").update({"code":4,"start":100,'endtime':int(time.time()),'updtime':int(time.time())})
|
|
71
|
+
else:
|
|
72
|
+
try:
|
|
73
|
+
value['target']()
|
|
74
|
+
except:
|
|
75
|
+
kcwsqlite.sqlite.connect(queuesdbpath,th_lock=True).table("model_kcwebs_queues").where("taskid = '"+value['task']['taskid']+"' and code!=4").update({"code":1,'endtime':int(time.time()),'updtime':int(time.time()),"error":str(traceback.format_exc())})
|
|
76
|
+
else:
|
|
77
|
+
kcwsqlite.sqlite.connect(queuesdbpath,th_lock=True).table("model_kcwebs_queues").where("taskid = '"+value['task']['taskid']+"' and code!=4").update({"code":4,"start":100,'endtime':int(time.time()),'updtime':int(time.time())})
|
|
78
|
+
time.sleep(1)
|
|
79
|
+
def __taskmessagequeue():
|
|
80
|
+
kcwsqlite.sqlite.connect(queuesdbpath,th_lock=True).table("model_kcwebs_queues").where("code=2 and updtime<"+str(int(time.time())-86400*7)).delete()
|
|
81
|
+
kcwsqlite.sqlite.connect(queuesdbpath,th_lock=True).table("model_kcwebs_queues").where("code=3 and updtime<"+str(int(time.time())-1200)).delete()
|
|
82
|
+
while True:
|
|
83
|
+
if not Queues.__scripttask.empty():
|
|
84
|
+
value=Queues.__scripttask.get()
|
|
85
|
+
Queues.__scripttasklist.append(value)
|
|
86
|
+
else:
|
|
87
|
+
time.sleep(0.01)
|
|
42
88
|
def __startprocess():
|
|
43
89
|
if not Queues.__processglobalqueue:
|
|
44
90
|
if not os.path.isfile(queuesdbpath):
|
|
@@ -50,8 +96,8 @@ class Queues():
|
|
|
50
96
|
model_kcwebs_tasks=model_kcwebs_task()
|
|
51
97
|
model_kcwebs_tasks.create_table()
|
|
52
98
|
Queues.__processglobalqueue=multiprocessing.Queue()
|
|
53
|
-
t=multiprocessing.Process(target=Queues._messagequeueprocess,args=(Queues.__processglobalqueue,))
|
|
54
|
-
t.daemon=True
|
|
99
|
+
t=multiprocessing.Process(target=Queues._messagequeueprocess,args=(Queues.__processglobalqueue,),daemon=True)
|
|
100
|
+
# t.daemon=True
|
|
55
101
|
t.start()
|
|
56
102
|
def _messagequeueprocess(processglobalqueue):
|
|
57
103
|
"""不支持外部调用"""
|
|
@@ -175,21 +221,69 @@ class Queues():
|
|
|
175
221
|
else:
|
|
176
222
|
Queues.__start()
|
|
177
223
|
ttt=int(time.time())
|
|
224
|
+
|
|
225
|
+
end=100
|
|
226
|
+
if not updtime:
|
|
227
|
+
updtime=ttt
|
|
178
228
|
if not taskid:
|
|
179
229
|
m = hashlib.md5()
|
|
180
230
|
m.update((str(ttt)+str(random.randint(100000,999999))).encode(encoding='utf-8'))
|
|
181
231
|
taskid=m.hexdigest()
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
232
|
+
else:
|
|
233
|
+
arr=kcwsqlite.sqlite.connect(queuesdbpath,th_lock=True).table("model_kcwebs_queues").where("taskid",taskid).find()
|
|
234
|
+
if arr:
|
|
235
|
+
if arr['code'] in [2,3]:
|
|
236
|
+
return taskid
|
|
237
|
+
else:
|
|
238
|
+
kcwsqlite.sqlite.connect(queuesdbpath,th_lock=True).table("model_kcwebs_queues").where("taskid",taskid).delete()
|
|
185
239
|
task={"taskid":taskid,"title":title,"describes":describes,"code":2,"msg":msg,"error":"","start":start,"end":end,"addtime":ttt,'starts':0,'endtime':0,'updtime':updtime}
|
|
186
|
-
key={"target":target,"args":args,"task":task}
|
|
187
240
|
kcwsqlite.sqlite.connect(queuesdbpath,th_lock=True).table("model_kcwebs_queues").insert(task)
|
|
241
|
+
key={"target":target,"args":args,"task":task}
|
|
188
242
|
if types=='process':
|
|
189
243
|
Queues.__processglobalqueue.put(key)
|
|
190
244
|
else:
|
|
191
245
|
Queues.__globalqueue.put(key)
|
|
192
246
|
return taskid
|
|
247
|
+
def inserttask(target,args=None,title="默认任务",describes='',msg='',taskid=None,start=0,updtime=0): #add_queue
|
|
248
|
+
"""添加后台任务
|
|
249
|
+
|
|
250
|
+
target 方法名 必须
|
|
251
|
+
|
|
252
|
+
args 方法参数 非必须 如 (参数1,参数2)
|
|
253
|
+
|
|
254
|
+
title 任务名称
|
|
255
|
+
|
|
256
|
+
describes 任务描述
|
|
257
|
+
|
|
258
|
+
msg 状态描述
|
|
259
|
+
|
|
260
|
+
taskid 任务id
|
|
261
|
+
|
|
262
|
+
start 进度条开始位置 (建议1到50)
|
|
263
|
+
|
|
264
|
+
updtime 进度条更新时间
|
|
265
|
+
|
|
266
|
+
return taskid
|
|
267
|
+
"""
|
|
268
|
+
Queues.__script()
|
|
269
|
+
ttt=int(time.time())
|
|
270
|
+
|
|
271
|
+
end=100
|
|
272
|
+
if not updtime:
|
|
273
|
+
updtime=ttt
|
|
274
|
+
if not taskid:
|
|
275
|
+
m = hashlib.md5()
|
|
276
|
+
m.update((str(ttt)+str(random.randint(100000,999999))).encode(encoding='utf-8'))
|
|
277
|
+
taskid=m.hexdigest()
|
|
278
|
+
else:
|
|
279
|
+
arr=kcwsqlite.sqlite.connect(queuesdbpath,th_lock=True).table("model_kcwebs_queues").where("taskid",taskid).find()
|
|
280
|
+
if arr:
|
|
281
|
+
return taskid
|
|
282
|
+
task={"taskid":taskid,"title":title,"describes":describes,"code":2,"msg":msg,"error":"","start":start,"end":end,"addtime":ttt,'starts':0,'endtime':0,'updtime':updtime}
|
|
283
|
+
kcwsqlite.sqlite.connect(queuesdbpath,th_lock=True).table("model_kcwebs_queues").insert(task)
|
|
284
|
+
key={"target":target,"args":args,"task":task}
|
|
285
|
+
Queues.__scripttask.put(key)
|
|
286
|
+
return taskid
|
|
193
287
|
def getall(pagenow=1,pagesize=20,where=None):
|
|
194
288
|
"""获取全部队列
|
|
195
289
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 1.2
|
|
2
2
|
Name: kcwebs
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.23
|
|
4
4
|
Summary: kcwebs作为web开发而设计的高性能框架
|
|
5
5
|
Home-page: https://docs.kwebapp.cn/index/index/2
|
|
6
6
|
Author: 百里-坤坤
|
|
@@ -9,5 +9,5 @@ Maintainer: 坤坤
|
|
|
9
9
|
Maintainer-email: fk1402936534@qq.com
|
|
10
10
|
License: MIT License
|
|
11
11
|
Description: kcwebs作为web开发而设计的高性能框架,采用全新的架构思想,注重易用性。遵循MIT开源许可协议发布,意味着个人和企业可以免费使用kcwebs,甚至允许把你基于kcwebs开发的应用开源或商业产品发布或销售。完整文档请访问:https://docs.kwebapp.cn/index/index/2
|
|
12
|
-
Keywords: kcwebs3.
|
|
12
|
+
Keywords: kcwebs3.23
|
|
13
13
|
Platform: UNKNOWN
|
|
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
|
{kcwebs-3.21 → kcwebs-3.23}/kcwebs/tempfile/kcwebs/app/api/controller/index/common/__init__.py
RENAMED
|
File without changes
|
{kcwebs-3.21 → kcwebs-3.23}/kcwebs/tempfile/kcwebs/app/api/controller/index/common/autoload.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{kcwebs-3.21 → kcwebs-3.23}/kcwebs/tempfile/kcwebs/app/api/controller/index/tpl/index/home.html
RENAMED
|
File without changes
|
{kcwebs-3.21 → kcwebs-3.23}/kcwebs/tempfile/kcwebs/app/api/controller/index/tpl/index/index.html
RENAMED
|
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
|