funboost 43.1__py3-none-any.whl → 43.3__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 +10 -4
- funboost/consumers/celery_consumer.py +2 -2
- funboost/core/booster.py +3 -0
- funboost/funboost_config_deafult.py +1 -1
- {funboost-43.1.dist-info → funboost-43.3.dist-info}/METADATA +2 -2
- {funboost-43.1.dist-info → funboost-43.3.dist-info}/RECORD +11 -11
- {funboost-43.1.dist-info → funboost-43.3.dist-info}/LICENSE +0 -0
- {funboost-43.1.dist-info → funboost-43.3.dist-info}/WHEEL +0 -0
- {funboost-43.1.dist-info → funboost-43.3.dist-info}/entry_points.txt +0 -0
- {funboost-43.1.dist-info → funboost-43.3.dist-info}/top_level.txt +0 -0
funboost/__init__.py
CHANGED
|
@@ -69,8 +69,9 @@ from funboost.utils import decorators, time_util, redis_manager
|
|
|
69
69
|
from funboost.constant import ConcurrentModeEnum, BrokerEnum
|
|
70
70
|
from funboost.core import kill_remote_task
|
|
71
71
|
from funboost.core.exceptions import ExceptionForRequeue, ExceptionForPushToDlxqueue
|
|
72
|
+
|
|
72
73
|
# from funboost.core.booster import BoostersManager 互相导入
|
|
73
|
-
from funboost.core.lazy_impoter import
|
|
74
|
+
from funboost.core.lazy_impoter import lazy_impoter
|
|
74
75
|
|
|
75
76
|
|
|
76
77
|
# patch_apscheduler_run_job()
|
|
@@ -230,7 +231,7 @@ class AbstractConsumer(LoggerLevelSetterMixin, metaclass=abc.ABCMeta, ):
|
|
|
230
231
|
if logger_prefix != '':
|
|
231
232
|
logger_prefix += '--'
|
|
232
233
|
# logger_name = f'{logger_prefix}{self.__class__.__name__}--{concurrent_name}--{queue_name}--{self.consuming_function.__name__}'
|
|
233
|
-
logger_name = self.consumer_params.logger_name or
|
|
234
|
+
logger_name = self.consumer_params.logger_name or f'funboost.{logger_prefix}{self.__class__.__name__}--{self.queue_name}'
|
|
234
235
|
self.logger_name = logger_name
|
|
235
236
|
log_filename = self.consumer_params.log_filename or f'funboost.{self.queue_name}.log'
|
|
236
237
|
self.logger = LogManager(logger_name, logger_cls=TaskIdLogger).get_logger_and_add_handlers(
|
|
@@ -318,7 +319,12 @@ class AbstractConsumer(LoggerLevelSetterMixin, metaclass=abc.ABCMeta, ):
|
|
|
318
319
|
def start_consuming_message(self):
|
|
319
320
|
# ConsumersManager.show_all_consumer_info()
|
|
320
321
|
# noinspection PyBroadException
|
|
321
|
-
|
|
322
|
+
pid_queue_name_tuple = (os.getpid(), self.queue_name)
|
|
323
|
+
if pid_queue_name_tuple in lazy_impoter.BoostersManager.pid_queue_name__has_start_consume_set:
|
|
324
|
+
self.logger.warning(f'{pid_queue_name_tuple} 已启动消费,不要一直去启动消费,funboost框架自动阻止.') # 有的人乱写代码,无数次在函数内部或for循环里面执行 f.consume(),一个队列只需要启动一次消费,不然每启动一次性能消耗很大,直到程序崩溃
|
|
325
|
+
return
|
|
326
|
+
else:
|
|
327
|
+
lazy_impoter.BoostersManager.pid_queue_name__has_start_consume_set.add(pid_queue_name_tuple)
|
|
322
328
|
GlobalVars.has_start_a_consumer_flag = True
|
|
323
329
|
try:
|
|
324
330
|
self._concurrent_mode_dispatcher.check_all_concurrent_mode()
|
|
@@ -365,7 +371,7 @@ class AbstractConsumer(LoggerLevelSetterMixin, metaclass=abc.ABCMeta, ):
|
|
|
365
371
|
key = 'apscheduler.redisjobstore_runonce'
|
|
366
372
|
if RedisMixin().redis_db_frame.sadd(key, runonce_uuid): # 这样可以阻止多次启动同队列名消费者 redis jobstore多次运行函数.
|
|
367
373
|
cls.logger_apscheduler.debug(f'延时任务用普通消息重新发布到普通队列 {msg}')
|
|
368
|
-
|
|
374
|
+
lazy_impoter.BoostersManager.get_or_create_booster_by_queue_name(queue_name).publish(msg)
|
|
369
375
|
|
|
370
376
|
@abc.abstractmethod
|
|
371
377
|
def _shedual_task(self):
|
|
@@ -175,10 +175,10 @@ class CeleryConsumer(AbstractConsumer):
|
|
|
175
175
|
# print(this.request.__dict__,dir(this))
|
|
176
176
|
if this.request.retries != self.consumer_params.max_retry_times:
|
|
177
177
|
log_msg = f'fun: {self.consuming_function} args: {args} , kwargs: {kwargs} 消息第{this.request.retries}次运行出错, {exc} \n'
|
|
178
|
-
self.
|
|
178
|
+
self.logger.error(log_msg, exc_info=self.consumer_params.is_print_detail_exception)
|
|
179
179
|
else:
|
|
180
180
|
log_msg = f'fun: {self.consuming_function} args: {args} , kwargs: {kwargs} 消息达到最大重试次数{this.request.retries}次仍然出错, {exc} \n'
|
|
181
|
-
self.
|
|
181
|
+
self.logger.critical(log_msg, exc_info=self.consumer_params.is_print_detail_exception)
|
|
182
182
|
# 发生异常,尝试重试任务,countdown 是多少秒后重试
|
|
183
183
|
raise this.retry(exc=exc, countdown=5)
|
|
184
184
|
|
funboost/core/booster.py
CHANGED
|
@@ -13,6 +13,7 @@ from funboost.core.exceptions import BoostDecoParamsIsOldVersion
|
|
|
13
13
|
from funboost.core.func_params_model import BoosterParams, FunctionResultStatusPersistanceConfig, PriorityConsumingControlConfig
|
|
14
14
|
|
|
15
15
|
from funboost.factories.consumer_factory import get_consumer
|
|
16
|
+
from collections import defaultdict
|
|
16
17
|
|
|
17
18
|
if typing.TYPE_CHECKING:
|
|
18
19
|
from funboost.core.msg_result_getter import AsyncResult
|
|
@@ -180,6 +181,8 @@ class BoostersManager:
|
|
|
180
181
|
# queue_name__boost_params_consuming_function_map 字典存放 {queue_name,(@boost的入参字典,@boost装饰的消费函数)}
|
|
181
182
|
queue_name__boost_params_map = {} # type: typing.Dict[str,BoosterParams]
|
|
182
183
|
|
|
184
|
+
pid_queue_name__has_start_consume_set = set()
|
|
185
|
+
|
|
183
186
|
@classmethod
|
|
184
187
|
def regist_booster(cls, queue_name: str, booster: Booster):
|
|
185
188
|
"""这个是框架在@boost时候自动调用的,无需用户亲自调用"""
|
|
@@ -100,7 +100,7 @@ class FunboostCommonConfig(DataClassBase):
|
|
|
100
100
|
# NB_LOG_FORMATER_INDEX_FOR_CONSUMER_AND_PUBLISHER = 11 # 7是简短的不可跳转,5是可点击跳转的,11是可显示ip 进程 线程的模板,也可以亲自设置日志模板不传递数字。
|
|
101
101
|
NB_LOG_FORMATER_INDEX_FOR_CONSUMER_AND_PUBLISHER = logging.Formatter(
|
|
102
102
|
f'%(asctime)s-({nb_log_config_default.computer_ip},{nb_log_config_default.computer_name})-[p%(process)d_t%(thread)d] - %(name)s - "%(filename)s:%(lineno)d" - %(funcName)s - %(levelname)s - %(task_id)s - %(message)s',
|
|
103
|
-
"%Y-%m-%d %H:%M:%S",) # 这个是带task_id的日志模板,日志可以显示task_id
|
|
103
|
+
"%Y-%m-%d %H:%M:%S",) # 这个是带task_id的日志模板,日志可以显示task_id,方便用户串联起来排查某一个任务消息的所有日志.
|
|
104
104
|
|
|
105
105
|
TIMEZONE = 'Asia/Shanghai' # 时区
|
|
106
106
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: funboost
|
|
3
|
-
Version: 43.
|
|
3
|
+
Version: 43.3
|
|
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
|
|
@@ -26,7 +26,7 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
26
26
|
Classifier: Topic :: Software Development :: Libraries
|
|
27
27
|
Description-Content-Type: text/markdown
|
|
28
28
|
License-File: LICENSE
|
|
29
|
-
Requires-Dist: nb-log >=12.
|
|
29
|
+
Requires-Dist: nb-log >=12.6
|
|
30
30
|
Requires-Dist: eventlet ==0.33.3
|
|
31
31
|
Requires-Dist: gevent ==22.10.2
|
|
32
32
|
Requires-Dist: pymongo ==4.3.3
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
funboost/__init__.py,sha256
|
|
1
|
+
funboost/__init__.py,sha256=-3RJlrk1I9V6-LPbqzYVOGPIPcfZgsX4PGKUoAJJyRM,3832
|
|
2
2
|
funboost/__init__old.py,sha256=07A1MLsxLtuRQQOIfDyphddOwNBrGe34enoHWAnjV14,20379
|
|
3
3
|
funboost/__main__.py,sha256=-6Nogi666Y0LN8fVm3JmHGTOk8xEGWvotW_GDbSaZME,1065
|
|
4
4
|
funboost/constant.py,sha256=Yxt3WJt9D8ybcrgiojOy0qjnq5mffwTnTJplerGL0Oo,7188
|
|
5
|
-
funboost/funboost_config_deafult.py,sha256=
|
|
5
|
+
funboost/funboost_config_deafult.py,sha256=rwfHVttpqWX5tGoO7MdiCquHSrK-z56U81df-jnavlc,6613
|
|
6
6
|
funboost/set_frame_config.py,sha256=bEsW4a4EuE3PpyypNuWSfsB-_bvT94pktJGKk4r-rlo,14328
|
|
7
7
|
funboost/assist/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
8
|
funboost/assist/celery_helper.py,sha256=ae8nbwHEulXa9gSKrNkW87SS8BZx7ZJwzWYY6hniE2g,5603
|
|
@@ -33,8 +33,8 @@ 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=
|
|
37
|
-
funboost/consumers/celery_consumer.py,sha256=
|
|
36
|
+
funboost/consumers/base_consumer.py,sha256=yPWABuEWIi3Ef2X_6lvmME3WOsmq1XbxzGUo25iMC74,74467
|
|
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
|
|
40
40
|
funboost/consumers/http_consumer.py,sha256=3HF8tsH90fUPX3iOmVid_nqW_7hZCFaL7feOkuAM36U,2025
|
|
@@ -81,7 +81,7 @@ funboost/contrib/redis_consume_latest_msg_broker.py,sha256=ESortBZ2qu_4PBCa3e3Fe
|
|
|
81
81
|
funboost/contrib/save_result_status_to_sqldb.py,sha256=AxvD7nHs4sjr9U0kwEZzyPKrsGdU_JzEgzzhh_V1_4w,4071
|
|
82
82
|
funboost/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
83
83
|
funboost/core/active_cousumer_info_getter.py,sha256=09fEc-BTEIRfDDfHmOvKnMjLjtOyp4edLsUlAXUR_Qs,4966
|
|
84
|
-
funboost/core/booster.py,sha256=
|
|
84
|
+
funboost/core/booster.py,sha256=Y_HqdK1mOFUyTzuEU070kTWQfXR7j0WVHIOfrAdPhAQ,15831
|
|
85
85
|
funboost/core/current_task.py,sha256=rAIQVLqYqtlHVRkjl17yki-mqvuMb640ssGmto4RSdA,4864
|
|
86
86
|
funboost/core/exceptions.py,sha256=pLF7BkRJAfDiWp2_xGZqencmwdPiSQI1NENbImExknY,1311
|
|
87
87
|
funboost/core/fabric_deploy_helper.py,sha256=KPjifNy1G1tDOT2eaR0X8hegot0HUk5vF-P1DnhxME4,8941
|
|
@@ -264,9 +264,9 @@ funboost/utils/pysnooper_ydf/utils.py,sha256=evSmGi_Oul7vSP47AJ0DLjFwoCYCfunJZ1m
|
|
|
264
264
|
funboost/utils/pysnooper_ydf/variables.py,sha256=QejRDESBA06KG9OH4sBT4J1M55eaU29EIHg8K_igaXo,3693
|
|
265
265
|
funboost/utils/times/__init__.py,sha256=Y4bQD3SIA_E7W2YvHq2Qdi0dGM4H2DxyFNdDOuFOq1w,2417
|
|
266
266
|
funboost/utils/times/version.py,sha256=11XfnZVVzOgIhXXdeN_mYfdXThfrsbQHpA0wCjz-hpg,17
|
|
267
|
-
funboost-43.
|
|
268
|
-
funboost-43.
|
|
269
|
-
funboost-43.
|
|
270
|
-
funboost-43.
|
|
271
|
-
funboost-43.
|
|
272
|
-
funboost-43.
|
|
267
|
+
funboost-43.3.dist-info/LICENSE,sha256=9EPP2ktG_lAPB8PjmWV-c9BiaJHc_FP6pPLcUrUwx0E,11562
|
|
268
|
+
funboost-43.3.dist-info/METADATA,sha256=Lhj9E5wR-9MOrar-tkuQeGD-ane_9Qx1UHqtR59MNJU,30477
|
|
269
|
+
funboost-43.3.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
|
|
270
|
+
funboost-43.3.dist-info/entry_points.txt,sha256=yMSSAGRzRAAhGyNNQHw24MooKlDZsaJ499_D6fPl58A,96
|
|
271
|
+
funboost-43.3.dist-info/top_level.txt,sha256=K8WuKnS6MRcEWxP1NvbmCeujJq6TEfbsB150YROlRw0,9
|
|
272
|
+
funboost-43.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|