funboost 43.1__py3-none-any.whl → 43.2__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 CHANGED
@@ -13,7 +13,7 @@ set_frame_config这个模块的 use_config_form_funboost_config_module() 是核
13
13
  这段注释说明和使用的用户无关,只和框架开发人员有关.
14
14
  '''
15
15
 
16
- __version__ = "43.1"
16
+ __version__ = "43.2"
17
17
 
18
18
  from funboost.set_frame_config import show_frame_config
19
19
 
@@ -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 LazyImpoter
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 f'funboost.{logger_prefix}{self.__class__.__name__}--{self.queue_name}'
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
- LazyImpoter().BoostersManager.get_or_create_booster_by_queue_name(queue_name).publish(msg)
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):
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时候自动调用的,无需用户亲自调用"""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: funboost
3
- Version: 43.1
3
+ Version: 43.2
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=pUJ4iS5AiUCxH6utC0qcxgNhw2bNTzZdZQruG3ITny8,3832
1
+ funboost/__init__.py,sha256=x5lG3PWSM6K656iGvnlg8T7uq07hTuhXOeN-cIamYNY,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
@@ -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=fRP9oHn8yt2Te0zPg6e5SvuOgS6RaciX8lcn8y_Fphs,73843
36
+ funboost/consumers/base_consumer.py,sha256=yPWABuEWIi3Ef2X_6lvmME3WOsmq1XbxzGUo25iMC74,74467
37
37
  funboost/consumers/celery_consumer.py,sha256=W25gbGyimf8KG5lLbtgar3Ix7F3O4cIRBLtRq8nJ0AE,9216
38
38
  funboost/consumers/confirm_mixin.py,sha256=eY6fNwx51Hn4bQSYRjyTRwOqfCGsikVnd2Ga_Ep31N4,6062
39
39
  funboost/consumers/dramatiq_consumer.py,sha256=ozmeAfeF0U-YNYHK4suQB0N264h5AZdfMH0O45Mh-8A,2229
@@ -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=k6UPxfW7QdhfdVu9yprHkF46jLO2eXTqTZPYkukmyZc,15741
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.1.dist-info/LICENSE,sha256=9EPP2ktG_lAPB8PjmWV-c9BiaJHc_FP6pPLcUrUwx0E,11562
268
- funboost-43.1.dist-info/METADATA,sha256=gff3PpG5XbihV95vroXQonZMfW48XwTiGyoEuUxfEw8,30477
269
- funboost-43.1.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
270
- funboost-43.1.dist-info/entry_points.txt,sha256=yMSSAGRzRAAhGyNNQHw24MooKlDZsaJ499_D6fPl58A,96
271
- funboost-43.1.dist-info/top_level.txt,sha256=K8WuKnS6MRcEWxP1NvbmCeujJq6TEfbsB150YROlRw0,9
272
- funboost-43.1.dist-info/RECORD,,
267
+ funboost-43.2.dist-info/LICENSE,sha256=9EPP2ktG_lAPB8PjmWV-c9BiaJHc_FP6pPLcUrUwx0E,11562
268
+ funboost-43.2.dist-info/METADATA,sha256=mxmDQN0utl_HDlleptNs8-0NykInyLL-pn0-igsQ8_c,30477
269
+ funboost-43.2.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
270
+ funboost-43.2.dist-info/entry_points.txt,sha256=yMSSAGRzRAAhGyNNQHw24MooKlDZsaJ499_D6fPl58A,96
271
+ funboost-43.2.dist-info/top_level.txt,sha256=K8WuKnS6MRcEWxP1NvbmCeujJq6TEfbsB150YROlRw0,9
272
+ funboost-43.2.dist-info/RECORD,,