funboost 44.6__py3-none-any.whl → 44.8__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.
Potentially problematic release.
This version of funboost might be problematic. Click here for more details.
- funboost/__init__.py +1 -1
- funboost/consumers/base_consumer.py +12 -3
- funboost/core/current_task.py +9 -2
- funboost/core/func_params_model.py +19 -0
- funboost/core/lazy_impoter.py +8 -2
- {funboost-44.6.dist-info → funboost-44.8.dist-info}/METADATA +1 -1
- {funboost-44.6.dist-info → funboost-44.8.dist-info}/RECORD +11 -11
- {funboost-44.6.dist-info → funboost-44.8.dist-info}/LICENSE +0 -0
- {funboost-44.6.dist-info → funboost-44.8.dist-info}/WHEEL +0 -0
- {funboost-44.6.dist-info → funboost-44.8.dist-info}/entry_points.txt +0 -0
- {funboost-44.6.dist-info → funboost-44.8.dist-info}/top_level.txt +0 -0
funboost/__init__.py
CHANGED
|
@@ -565,6 +565,9 @@ class AbstractConsumer(LoggerLevelSetterMixin, metaclass=abc.ABCMeta, ):
|
|
|
565
565
|
def user_custom_record_process_info_func(self,current_function_result_status:FunctionResultStatus): # 这个可以继承
|
|
566
566
|
pass
|
|
567
567
|
|
|
568
|
+
async def aio_user_custom_record_process_info_func(self,current_function_result_status:FunctionResultStatus): # 这个可以继承
|
|
569
|
+
pass
|
|
570
|
+
|
|
568
571
|
# noinspection PyProtectedMember
|
|
569
572
|
def _run(self, kw: dict, ):
|
|
570
573
|
# print(kw)
|
|
@@ -636,7 +639,7 @@ class AbstractConsumer(LoggerLevelSetterMixin, metaclass=abc.ABCMeta, ):
|
|
|
636
639
|
self._current_time_for_execute_task_times_every_unit_time = time.time()
|
|
637
640
|
self._consuming_function_cost_time_total_every_unit_time = 0
|
|
638
641
|
self._execute_task_times_every_unit_time = 0
|
|
639
|
-
self.user_custom_record_process_info_func(current_function_result_status) #
|
|
642
|
+
self.user_custom_record_process_info_func(current_function_result_status) # 两种方式都可以自定义,记录结果,建议继承方式,不使用boost中指定 user_custom_record_process_info_func
|
|
640
643
|
if self.consumer_params.user_custom_record_process_info_func:
|
|
641
644
|
self.consumer_params.user_custom_record_process_info_func(current_function_result_status)
|
|
642
645
|
except BaseException as e:
|
|
@@ -660,7 +663,10 @@ class AbstractConsumer(LoggerLevelSetterMixin, metaclass=abc.ABCMeta, ):
|
|
|
660
663
|
try:
|
|
661
664
|
function_run = self.consuming_function
|
|
662
665
|
if self._consuming_function_is_asyncio:
|
|
666
|
+
fct._fct_local_data._asyncio_use_thread_concurrent_mode = True
|
|
663
667
|
function_run = sync_or_async_fun_deco(function_run)
|
|
668
|
+
else:
|
|
669
|
+
fct._fct_local_data._asynco_use_thread_concurrent_mode = False
|
|
664
670
|
function_timeout = self._get_priority_conf(kw, 'function_timeout')
|
|
665
671
|
function_run = function_run if self.consumer_params.consumin_function_decorator is None else self.consumer_params.consumin_function_decorator(function_run)
|
|
666
672
|
function_run = function_run if not function_timeout else self._concurrent_mode_dispatcher.timeout_deco(
|
|
@@ -801,8 +807,11 @@ class AbstractConsumer(LoggerLevelSetterMixin, metaclass=abc.ABCMeta, ):
|
|
|
801
807
|
self._consuming_function_cost_time_total_every_unit_time = 0
|
|
802
808
|
self._execute_task_times_every_unit_time = 0
|
|
803
809
|
|
|
810
|
+
self.user_custom_record_process_info_func(current_function_result_status) # 两种方式都可以自定义,记录结果.建议使用文档4.21.b的方式继承来重写
|
|
811
|
+
await self.aio_user_custom_record_process_info_func(current_function_result_status)
|
|
804
812
|
if self.consumer_params.user_custom_record_process_info_func:
|
|
805
|
-
|
|
813
|
+
self.consumer_params.user_custom_record_process_info_func(current_function_result_status)
|
|
814
|
+
|
|
806
815
|
except BaseException as e:
|
|
807
816
|
log_msg = f' error 严重错误 {type(e)} {e} '
|
|
808
817
|
# self.logger.critical(msg=f'{log_msg} \n', exc_info=True)
|
|
@@ -826,7 +835,7 @@ class AbstractConsumer(LoggerLevelSetterMixin, metaclass=abc.ABCMeta, ):
|
|
|
826
835
|
try:
|
|
827
836
|
corotinue_obj = self.consuming_function(**function_only_params)
|
|
828
837
|
if not asyncio.iscoroutine(corotinue_obj):
|
|
829
|
-
log_msg = f'''当前设置的并发模式为 async 并发模式,但消费函数不是异步协程函数,请不要把消费函数 {self.consuming_function.__name__} 的 concurrent_mode
|
|
838
|
+
log_msg = f'''当前设置的并发模式为 async 并发模式,但消费函数不是异步协程函数,请不要把消费函数 {self.consuming_function.__name__} 的 concurrent_mode 设置错误'''
|
|
830
839
|
# self.logger.critical(msg=f'{log_msg} \n')
|
|
831
840
|
# self.error_file_logger.critical(msg=f'{log_msg} \n')
|
|
832
841
|
self.logger.critical(msg=log_msg)
|
funboost/core/current_task.py
CHANGED
|
@@ -54,7 +54,7 @@ class __ThreadCurrentTask:
|
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
_fct_local_data = threading.local()
|
|
57
|
-
|
|
57
|
+
_fct_local_data._asyncio_use_thread_concurrent_mode = False
|
|
58
58
|
|
|
59
59
|
@property
|
|
60
60
|
def function_params(self):
|
|
@@ -146,7 +146,14 @@ class __AsyncioCurrentTask:
|
|
|
146
146
|
asyncio_current_task = __AsyncioCurrentTask()
|
|
147
147
|
|
|
148
148
|
def funboost_current_task():
|
|
149
|
-
|
|
149
|
+
if is_asyncio_environment():
|
|
150
|
+
if getattr(__ThreadCurrentTask._fct_local_data,'_asyncio_use_thread_concurrent_mode',None) is True:
|
|
151
|
+
# 如果用户使用的是默认的ConcurrentModeEnum.THREADING并发模式来运行async def 函数,那么也使用线程获取上下文
|
|
152
|
+
return thread_current_task
|
|
153
|
+
else:
|
|
154
|
+
return asyncio_current_task
|
|
155
|
+
else:
|
|
156
|
+
return thread_current_task
|
|
150
157
|
|
|
151
158
|
|
|
152
159
|
def get_current_taskid():
|
|
@@ -10,6 +10,8 @@ from funboost.concurrent_pool import FunboostBaseConcurrentPool, FlexibleThreadP
|
|
|
10
10
|
from funboost.constant import ConcurrentModeEnum, BrokerEnum
|
|
11
11
|
from pydantic import BaseModel, validator, root_validator, BaseConfig, Field
|
|
12
12
|
|
|
13
|
+
from funboost.core.lazy_impoter import funboost_lazy_impoter
|
|
14
|
+
|
|
13
15
|
|
|
14
16
|
def _patch_for_pydantic_field_deepcopy():
|
|
15
17
|
from concurrent.futures import ThreadPoolExecutor
|
|
@@ -188,6 +190,8 @@ class BoosterParams(BaseJsonAbleModel):
|
|
|
188
190
|
consumer_override_cls: typing.Optional[typing.Type] = None # 使用 consumer_override_cls 和 publisher_override_cls 来自定义重写或新增消费者 发布者,见文档4.21b介绍,
|
|
189
191
|
publisher_override_cls: typing.Optional[typing.Type] = None
|
|
190
192
|
|
|
193
|
+
# func_params_is_pydantic_model: bool = False # funboost 兼容支持 函数娼还是 pydantic model类型,funboost在发布之前和取出来时候自己转化。
|
|
194
|
+
|
|
191
195
|
auto_generate_info: dict = {} # 自动生成的信息,不需要用户主动传参.
|
|
192
196
|
|
|
193
197
|
@root_validator(skip_on_failure=True)
|
|
@@ -211,6 +215,19 @@ class BoosterParams(BaseJsonAbleModel):
|
|
|
211
215
|
raise ValueError(f'{cls.__name__} 的字段新增了父类 BoosterParams 不存在的字段 "{k}"') # 使 BoosterParams的子类,不能增加字段,只能覆盖字段.
|
|
212
216
|
return values
|
|
213
217
|
|
|
218
|
+
def __call__(self, func):
|
|
219
|
+
"""
|
|
220
|
+
新增加一种语法
|
|
221
|
+
@BoosterParams(queue_name='q1',qps=2) 这个和 @boost(BoosterParams(queue_name='q1',qps=2)) 写法等效
|
|
222
|
+
|
|
223
|
+
@BoosterParams(queue_name='q1',qps=2)
|
|
224
|
+
def f(a,b):
|
|
225
|
+
print(a,b)
|
|
226
|
+
:param func:
|
|
227
|
+
:return:
|
|
228
|
+
"""
|
|
229
|
+
return funboost_lazy_impoter.boost(self)(func)
|
|
230
|
+
|
|
214
231
|
|
|
215
232
|
class BoosterParamsComplete(BoosterParams):
|
|
216
233
|
"""
|
|
@@ -248,6 +265,7 @@ class PriorityConsumingControlConfig(BaseJsonAbleModel):
|
|
|
248
265
|
misfire_grace_time: typing.Union[int, None] = None
|
|
249
266
|
other_extra_params: dict = None # 其他参数, 例如消息优先级 , priority_control_config=PriorityConsumingControlConfig(other_extra_params={'priroty': priorityxx}),
|
|
250
267
|
|
|
268
|
+
|
|
251
269
|
@root_validator(skip_on_failure=True)
|
|
252
270
|
def cehck_values(cls, values: dict):
|
|
253
271
|
if values['countdown'] and values['eta']:
|
|
@@ -270,6 +288,7 @@ class PublisherParams(BaseJsonAbleModel):
|
|
|
270
288
|
broker_exclusive_config: dict = {}
|
|
271
289
|
should_check_publish_func_params: bool = True # 消息发布时候是否校验消息发布内容,比如有的人发布消息,函数只接受a,b两个入参,他去传2个入参,或者传参不存在的参数名字, 如果消费函数你非要写*args,**kwargs,那就需要关掉发布消息时候的函数入参检查
|
|
272
290
|
publisher_override_cls: typing.Optional[typing.Type] = None
|
|
291
|
+
# func_params_is_pydantic_model: bool = False # funboost 兼容支持 函数娼还是 pydantic model类型,funboost在发布之前和取出来时候自己转化。
|
|
273
292
|
|
|
274
293
|
|
|
275
294
|
if __name__ == '__main__':
|
funboost/core/lazy_impoter.py
CHANGED
|
@@ -16,8 +16,14 @@ class FunboostLazyImpoter(SingletonBaseNew):
|
|
|
16
16
|
@property
|
|
17
17
|
@cached_method_result
|
|
18
18
|
def BoostersManager(self):
|
|
19
|
-
from funboost.core
|
|
20
|
-
return BoostersManager
|
|
19
|
+
from funboost.core import booster
|
|
20
|
+
return booster.BoostersManager
|
|
21
|
+
|
|
22
|
+
@property
|
|
23
|
+
@cached_method_result
|
|
24
|
+
def boost(self):
|
|
25
|
+
from funboost.core import booster
|
|
26
|
+
return booster.boost
|
|
21
27
|
|
|
22
28
|
# @property
|
|
23
29
|
# @cached_method_result
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: funboost
|
|
3
|
-
Version: 44.
|
|
3
|
+
Version: 44.8
|
|
4
4
|
Summary: pip install funboost,python全功能分布式函数调度框架,。支持python所有类型的并发模式和一切知名消息队列中间件,支持如 celery dramatiq等框架整体作为funboost中间件,python函数加速器,框架包罗万象,用户能想到的控制功能全都有。一统编程思维,兼容50% python业务场景,适用范围广。只需要一行代码即可分布式执行python一切函数,99%用过funboost的pythoner 感受是 简易 方便 强劲 强大,相见恨晚
|
|
5
5
|
Home-page: https://github.com/ydf0509/funboost
|
|
6
6
|
Author: bfzs
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
funboost/__init__.py,sha256=
|
|
1
|
+
funboost/__init__.py,sha256=dARqxB-0k-6BcW45BJN1M_-r8bERE0ehK1FLcmVV0Aw,3957
|
|
2
2
|
funboost/__init__old.py,sha256=07A1MLsxLtuRQQOIfDyphddOwNBrGe34enoHWAnjV14,20379
|
|
3
3
|
funboost/__main__.py,sha256=-6Nogi666Y0LN8fVm3JmHGTOk8xEGWvotW_GDbSaZME,1065
|
|
4
4
|
funboost/constant.py,sha256=-QFaxH3tX9AlK9Fmq2hNjxuBWXpmnpCpuZayj7c-xW8,7768
|
|
@@ -33,7 +33,7 @@ funboost/concurrent_pool/backup/async_pool_executor0223.py,sha256=RVUZiylUvpTm6U
|
|
|
33
33
|
funboost/concurrent_pool/backup/async_pool_executor_back.py,sha256=KL6zEQaa1KkZOlAO85mCC1gwLm-YC5Ghn21IUom0UKM,9598
|
|
34
34
|
funboost/concurrent_pool/backup/async_pool_executor_janus.py,sha256=OHMWJ9l3EYTpPpcrPrGGKd4K0tmQ2PN8HiX0Dta0EOo,5728
|
|
35
35
|
funboost/consumers/__init__.py,sha256=ZXY_6Kut1VYNQiF5aWEgIWobsW1ht9YUP0TdRZRWFqI,126
|
|
36
|
-
funboost/consumers/base_consumer.py,sha256=
|
|
36
|
+
funboost/consumers/base_consumer.py,sha256=86M7IEBMiOBQd7x7TcJtLzBE1B-q0Ok3tuUVOdV_ZLs,77488
|
|
37
37
|
funboost/consumers/celery_consumer.py,sha256=9gtz7nlZkmv3ErmaseT0_Q__ltSPx-fOcwi-TMPoaLA,9220
|
|
38
38
|
funboost/consumers/confirm_mixin.py,sha256=eY6fNwx51Hn4bQSYRjyTRwOqfCGsikVnd2Ga_Ep31N4,6062
|
|
39
39
|
funboost/consumers/dramatiq_consumer.py,sha256=ozmeAfeF0U-YNYHK4suQB0N264h5AZdfMH0O45Mh-8A,2229
|
|
@@ -84,18 +84,18 @@ funboost/contrib/save_result_status_to_sqldb.py,sha256=AxvD7nHs4sjr9U0kwEZzyPKrs
|
|
|
84
84
|
funboost/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
85
85
|
funboost/core/active_cousumer_info_getter.py,sha256=09fEc-BTEIRfDDfHmOvKnMjLjtOyp4edLsUlAXUR_Qs,4966
|
|
86
86
|
funboost/core/booster.py,sha256=dEr3uFzGg3Tik3fvCm20WREIPpWO825Crj-DzBtby1w,17224
|
|
87
|
-
funboost/core/current_task.py,sha256=
|
|
87
|
+
funboost/core/current_task.py,sha256=P5OA8HIlFB5v0ko2xjz9tXUibBnLOPQb3KDlStO965Y,5280
|
|
88
88
|
funboost/core/exceptions.py,sha256=pLF7BkRJAfDiWp2_xGZqencmwdPiSQI1NENbImExknY,1311
|
|
89
89
|
funboost/core/fabric_deploy_helper.py,sha256=foieeqlNySuU9axJzNF6TavPjIUSYBx9UO3syVKUiyY,9999
|
|
90
90
|
funboost/core/funboost_config_getter.py,sha256=TDccp5pQamkoJXkwyPwGsQGDJY8ej8ZT8L8RESSAD2w,382
|
|
91
91
|
funboost/core/funboost_current_task_context_thread.py,sha256=RRhqmRl943jBccgTrsfra4lS20X0zB2TtLAUaZn_A18,441
|
|
92
92
|
funboost/core/funboost_time.py,sha256=IbB4dFCpg3oGUe90ssAJ_x0eDPtAVfvsUr4esdoKaOk,1777
|
|
93
|
-
funboost/core/func_params_model.py,sha256=
|
|
93
|
+
funboost/core/func_params_model.py,sha256=IeVs-JnUVkFGYH_1N9jB9R3KRAr5eNnEKDD9rPokmds,20308
|
|
94
94
|
funboost/core/function_result_status_config.py,sha256=PyjqAQOiwsLt28sRtH-eYRjiI3edPFO4Nde0ILFRReE,1764
|
|
95
95
|
funboost/core/function_result_status_saver.py,sha256=UdokGSwU630t70AZnT9Ecj7GpYXORBDivlc9kadoI2E,9172
|
|
96
96
|
funboost/core/helper_funs.py,sha256=1MZjedV6TGdaAjmj9q-ykgoTI_BtG9ZQm58PLOMVdDM,2362
|
|
97
97
|
funboost/core/kill_remote_task.py,sha256=MZ5vWLGt6SxyN76h5Lf_id9tyVUzjR-qXNyJwXaGlZY,8129
|
|
98
|
-
funboost/core/lazy_impoter.py,sha256=
|
|
98
|
+
funboost/core/lazy_impoter.py,sha256=5yToRBbTB338heR787ap5i-UAGN0FanUCkYfK9Nsgnk,4957
|
|
99
99
|
funboost/core/loggers.py,sha256=uy5mFLIUvKaVdJZLi6THyxqeuOmp9XEOKrH1Yci0zUM,2354
|
|
100
100
|
funboost/core/msg_result_getter.py,sha256=oZDuLDR5XQNzzvgDTsA7wroICToPwrkU9-OAaXXUQSk,8031
|
|
101
101
|
funboost/core/muliti_process_enhance.py,sha256=tI3178inc5sqPh-jQc0XaTuUD1diIZyHuukBRk1Gp6Y,3595
|
|
@@ -271,9 +271,9 @@ funboost/utils/pysnooper_ydf/utils.py,sha256=evSmGi_Oul7vSP47AJ0DLjFwoCYCfunJZ1m
|
|
|
271
271
|
funboost/utils/pysnooper_ydf/variables.py,sha256=QejRDESBA06KG9OH4sBT4J1M55eaU29EIHg8K_igaXo,3693
|
|
272
272
|
funboost/utils/times/__init__.py,sha256=Y4bQD3SIA_E7W2YvHq2Qdi0dGM4H2DxyFNdDOuFOq1w,2417
|
|
273
273
|
funboost/utils/times/version.py,sha256=11XfnZVVzOgIhXXdeN_mYfdXThfrsbQHpA0wCjz-hpg,17
|
|
274
|
-
funboost-44.
|
|
275
|
-
funboost-44.
|
|
276
|
-
funboost-44.
|
|
277
|
-
funboost-44.
|
|
278
|
-
funboost-44.
|
|
279
|
-
funboost-44.
|
|
274
|
+
funboost-44.8.dist-info/LICENSE,sha256=9EPP2ktG_lAPB8PjmWV-c9BiaJHc_FP6pPLcUrUwx0E,11562
|
|
275
|
+
funboost-44.8.dist-info/METADATA,sha256=412qwEz_NsQiel2b7RxWcT8NnGRa0WzZSScl_fLnUSw,31692
|
|
276
|
+
funboost-44.8.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
|
|
277
|
+
funboost-44.8.dist-info/entry_points.txt,sha256=BQMqRALuw-QT9x2d7puWaUHriXfy3wIzvfzF61AnSSI,97
|
|
278
|
+
funboost-44.8.dist-info/top_level.txt,sha256=K8WuKnS6MRcEWxP1NvbmCeujJq6TEfbsB150YROlRw0,9
|
|
279
|
+
funboost-44.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|