funboost 44.6__py3-none-any.whl → 44.7__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.

Files changed (72) hide show
  1. funboost/__init__.py +1 -1
  2. funboost/consumers/base_consumer.py +4 -1
  3. funboost/core/current_task.py +9 -2
  4. funboost/core/func_params_model.py +4 -0
  5. funboost/function_result_web/__pycache__/functions.cpython-39.pyc +0 -0
  6. funboost/utils/dependency_packages_in_pythonpath/__pycache__/__init__.cpython-39.pyc +0 -0
  7. funboost/utils/dependency_packages_in_pythonpath/__pycache__/add_to_pythonpath.cpython-39.pyc +0 -0
  8. funboost/utils/dependency_packages_in_pythonpath/aioredis/__init__.py +59 -59
  9. funboost/utils/dependency_packages_in_pythonpath/aioredis/__pycache__/__init__.cpython-39.pyc +0 -0
  10. funboost/utils/dependency_packages_in_pythonpath/aioredis/__pycache__/client.cpython-39.pyc +0 -0
  11. funboost/utils/dependency_packages_in_pythonpath/aioredis/__pycache__/compat.cpython-39.pyc +0 -0
  12. funboost/utils/dependency_packages_in_pythonpath/aioredis/__pycache__/connection.cpython-39.pyc +0 -0
  13. funboost/utils/dependency_packages_in_pythonpath/aioredis/__pycache__/exceptions.cpython-39.pyc +0 -0
  14. funboost/utils/dependency_packages_in_pythonpath/aioredis/__pycache__/lock.cpython-39.pyc +0 -0
  15. funboost/utils/dependency_packages_in_pythonpath/aioredis/__pycache__/utils.cpython-39.pyc +0 -0
  16. funboost/utils/dependency_packages_in_pythonpath/aioredis/client.py +4804 -4804
  17. funboost/utils/dependency_packages_in_pythonpath/aioredis/compat.py +8 -8
  18. funboost/utils/dependency_packages_in_pythonpath/aioredis/connection.py +1668 -1668
  19. funboost/utils/dependency_packages_in_pythonpath/aioredis/exceptions.py +96 -96
  20. funboost/utils/dependency_packages_in_pythonpath/aioredis/lock.py +306 -306
  21. funboost/utils/dependency_packages_in_pythonpath/aioredis/log.py +15 -15
  22. funboost/utils/dependency_packages_in_pythonpath/aioredis/sentinel.py +329 -329
  23. funboost/utils/dependency_packages_in_pythonpath/aioredis/utils.py +61 -61
  24. funboost/utils/dependency_packages_in_pythonpath/func_timeout/StoppableThread.py +133 -133
  25. funboost/utils/dependency_packages_in_pythonpath/func_timeout/__init__.py +16 -16
  26. funboost/utils/dependency_packages_in_pythonpath/func_timeout/__pycache__/StoppableThread.cpython-39.pyc +0 -0
  27. funboost/utils/dependency_packages_in_pythonpath/func_timeout/__pycache__/__init__.cpython-39.pyc +0 -0
  28. funboost/utils/dependency_packages_in_pythonpath/func_timeout/__pycache__/dafunc.cpython-39.pyc +0 -0
  29. funboost/utils/dependency_packages_in_pythonpath/func_timeout/__pycache__/exceptions.cpython-39.pyc +0 -0
  30. funboost/utils/dependency_packages_in_pythonpath/func_timeout/__pycache__/py3_raise.cpython-39.pyc +0 -0
  31. funboost/utils/dependency_packages_in_pythonpath/func_timeout/dafunc.py +244 -244
  32. funboost/utils/dependency_packages_in_pythonpath/func_timeout/exceptions.py +98 -98
  33. funboost/utils/dependency_packages_in_pythonpath/func_timeout/py2_raise.py +7 -7
  34. funboost/utils/dependency_packages_in_pythonpath/func_timeout/py3_raise.py +7 -7
  35. funboost/utils/times/__init__.py +85 -85
  36. funboost/utils/times/version.py +1 -1
  37. {funboost-44.6.dist-info → funboost-44.7.dist-info}/METADATA +1 -2
  38. {funboost-44.6.dist-info → funboost-44.7.dist-info}/RECORD +42 -71
  39. {funboost-44.6.dist-info → funboost-44.7.dist-info}/entry_points.txt +0 -1
  40. funboost/function_result_web/__pycache__/app.cpython-37.pyc +0 -0
  41. funboost/function_result_web/__pycache__/functions.cpython-37.pyc +0 -0
  42. funboost/utils/dependency_packages_in_pythonpath/__pycache__/__init__.cpython-311.pyc +0 -0
  43. funboost/utils/dependency_packages_in_pythonpath/__pycache__/__init__.cpython-37.pyc +0 -0
  44. funboost/utils/dependency_packages_in_pythonpath/__pycache__/add_to_pythonpath.cpython-311.pyc +0 -0
  45. funboost/utils/dependency_packages_in_pythonpath/__pycache__/add_to_pythonpath.cpython-37.pyc +0 -0
  46. funboost/utils/dependency_packages_in_pythonpath/aioredis/__pycache__/__init__.cpython-311.pyc +0 -0
  47. funboost/utils/dependency_packages_in_pythonpath/aioredis/__pycache__/__init__.cpython-37.pyc +0 -0
  48. funboost/utils/dependency_packages_in_pythonpath/aioredis/__pycache__/client.cpython-311.pyc +0 -0
  49. funboost/utils/dependency_packages_in_pythonpath/aioredis/__pycache__/client.cpython-37.pyc +0 -0
  50. funboost/utils/dependency_packages_in_pythonpath/aioredis/__pycache__/compat.cpython-311.pyc +0 -0
  51. funboost/utils/dependency_packages_in_pythonpath/aioredis/__pycache__/compat.cpython-37.pyc +0 -0
  52. funboost/utils/dependency_packages_in_pythonpath/aioredis/__pycache__/connection.cpython-311.pyc +0 -0
  53. funboost/utils/dependency_packages_in_pythonpath/aioredis/__pycache__/connection.cpython-37.pyc +0 -0
  54. funboost/utils/dependency_packages_in_pythonpath/aioredis/__pycache__/exceptions.cpython-311.pyc +0 -0
  55. funboost/utils/dependency_packages_in_pythonpath/aioredis/__pycache__/exceptions.cpython-37.pyc +0 -0
  56. funboost/utils/dependency_packages_in_pythonpath/aioredis/__pycache__/lock.cpython-311.pyc +0 -0
  57. funboost/utils/dependency_packages_in_pythonpath/aioredis/__pycache__/lock.cpython-37.pyc +0 -0
  58. funboost/utils/dependency_packages_in_pythonpath/aioredis/__pycache__/utils.cpython-311.pyc +0 -0
  59. funboost/utils/dependency_packages_in_pythonpath/aioredis/__pycache__/utils.cpython-37.pyc +0 -0
  60. funboost/utils/dependency_packages_in_pythonpath/func_timeout/__pycache__/StoppableThread.cpython-311.pyc +0 -0
  61. funboost/utils/dependency_packages_in_pythonpath/func_timeout/__pycache__/StoppableThread.cpython-37.pyc +0 -0
  62. funboost/utils/dependency_packages_in_pythonpath/func_timeout/__pycache__/__init__.cpython-311.pyc +0 -0
  63. funboost/utils/dependency_packages_in_pythonpath/func_timeout/__pycache__/__init__.cpython-37.pyc +0 -0
  64. funboost/utils/dependency_packages_in_pythonpath/func_timeout/__pycache__/dafunc.cpython-311.pyc +0 -0
  65. funboost/utils/dependency_packages_in_pythonpath/func_timeout/__pycache__/dafunc.cpython-37.pyc +0 -0
  66. funboost/utils/dependency_packages_in_pythonpath/func_timeout/__pycache__/exceptions.cpython-311.pyc +0 -0
  67. funboost/utils/dependency_packages_in_pythonpath/func_timeout/__pycache__/exceptions.cpython-37.pyc +0 -0
  68. funboost/utils/dependency_packages_in_pythonpath/func_timeout/__pycache__/py3_raise.cpython-311.pyc +0 -0
  69. funboost/utils/dependency_packages_in_pythonpath/func_timeout/__pycache__/py3_raise.cpython-37.pyc +0 -0
  70. {funboost-44.6.dist-info → funboost-44.7.dist-info}/LICENSE +0 -0
  71. {funboost-44.6.dist-info → funboost-44.7.dist-info}/WHEEL +0 -0
  72. {funboost-44.6.dist-info → funboost-44.7.dist-info}/top_level.txt +0 -0
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__ = "44.6"
16
+ __version__ = "44.7"
17
17
 
18
18
  from funboost.set_frame_config import show_frame_config
19
19
 
@@ -660,7 +660,10 @@ class AbstractConsumer(LoggerLevelSetterMixin, metaclass=abc.ABCMeta, ):
660
660
  try:
661
661
  function_run = self.consuming_function
662
662
  if self._consuming_function_is_asyncio:
663
+ fct._fct_local_data._asyncio_use_thread_concurrent_mode = True
663
664
  function_run = sync_or_async_fun_deco(function_run)
665
+ else:
666
+ fct._fct_local_data._asynco_use_thread_concurrent_mode = False
664
667
  function_timeout = self._get_priority_conf(kw, 'function_timeout')
665
668
  function_run = function_run if self.consumer_params.consumin_function_decorator is None else self.consumer_params.consumin_function_decorator(function_run)
666
669
  function_run = function_run if not function_timeout else self._concurrent_mode_dispatcher.timeout_deco(
@@ -826,7 +829,7 @@ class AbstractConsumer(LoggerLevelSetterMixin, metaclass=abc.ABCMeta, ):
826
829
  try:
827
830
  corotinue_obj = self.consuming_function(**function_only_params)
828
831
  if not asyncio.iscoroutine(corotinue_obj):
829
- log_msg = f'''当前设置的并发模式为 async 并发模式,但消费函数不是异步协程函数,请不要把消费函数 {self.consuming_function.__name__} 的 concurrent_mode 设置为 4'''
832
+ log_msg = f'''当前设置的并发模式为 async 并发模式,但消费函数不是异步协程函数,请不要把消费函数 {self.consuming_function.__name__} 的 concurrent_mode 设置错误'''
830
833
  # self.logger.critical(msg=f'{log_msg} \n')
831
834
  # self.error_file_logger.critical(msg=f'{log_msg} \n')
832
835
  self.logger.critical(msg=log_msg)
@@ -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
- return asyncio_current_task if is_asyncio_environment() else thread_current_task
149
+ if is_asyncio_environment():
150
+ if getattr(__ThreadCurrentTask._fct_local_data,'_asyncio_use_thread_concurrent_mode',None) is True:
151
+ # 如果用户使用的是默认的ConcurrentModeEnum.THREADING并发模式,那么也使用线程获取上下文
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():
@@ -188,6 +188,8 @@ class BoosterParams(BaseJsonAbleModel):
188
188
  consumer_override_cls: typing.Optional[typing.Type] = None # 使用 consumer_override_cls 和 publisher_override_cls 来自定义重写或新增消费者 发布者,见文档4.21b介绍,
189
189
  publisher_override_cls: typing.Optional[typing.Type] = None
190
190
 
191
+ # func_params_is_pydantic_model: bool = False # funboost 兼容支持 函数娼还是 pydantic model类型,funboost在发布之前和取出来时候自己转化。
192
+
191
193
  auto_generate_info: dict = {} # 自动生成的信息,不需要用户主动传参.
192
194
 
193
195
  @root_validator(skip_on_failure=True)
@@ -248,6 +250,7 @@ class PriorityConsumingControlConfig(BaseJsonAbleModel):
248
250
  misfire_grace_time: typing.Union[int, None] = None
249
251
  other_extra_params: dict = None # 其他参数, 例如消息优先级 , priority_control_config=PriorityConsumingControlConfig(other_extra_params={'priroty': priorityxx}),
250
252
 
253
+
251
254
  @root_validator(skip_on_failure=True)
252
255
  def cehck_values(cls, values: dict):
253
256
  if values['countdown'] and values['eta']:
@@ -270,6 +273,7 @@ class PublisherParams(BaseJsonAbleModel):
270
273
  broker_exclusive_config: dict = {}
271
274
  should_check_publish_func_params: bool = True # 消息发布时候是否校验消息发布内容,比如有的人发布消息,函数只接受a,b两个入参,他去传2个入参,或者传参不存在的参数名字, 如果消费函数你非要写*args,**kwargs,那就需要关掉发布消息时候的函数入参检查
272
275
  publisher_override_cls: typing.Optional[typing.Type] = None
276
+ # func_params_is_pydantic_model: bool = False # funboost 兼容支持 函数娼还是 pydantic model类型,funboost在发布之前和取出来时候自己转化。
273
277
 
274
278
 
275
279
  if __name__ == '__main__':
@@ -1,59 +1,59 @@
1
- from aioredis.client import Redis, StrictRedis
2
- from aioredis.connection import (
3
- BlockingConnectionPool,
4
- Connection,
5
- ConnectionPool,
6
- SSLConnection,
7
- UnixDomainSocketConnection,
8
- )
9
- from aioredis.exceptions import (
10
- AuthenticationError,
11
- AuthenticationWrongNumberOfArgsError,
12
- BusyLoadingError,
13
- ChildDeadlockedError,
14
- ConnectionError,
15
- DataError,
16
- InvalidResponse,
17
- PubSubError,
18
- ReadOnlyError,
19
- RedisError,
20
- ResponseError,
21
- TimeoutError,
22
- WatchError,
23
- )
24
- from aioredis.utils import from_url
25
-
26
-
27
- def int_or_str(value):
28
- try:
29
- return int(value)
30
- except ValueError:
31
- return value
32
-
33
-
34
- __version__ = "2.0.1"
35
- VERSION = tuple(map(int_or_str, __version__.split(".")))
36
-
37
- __all__ = [
38
- "AuthenticationError",
39
- "AuthenticationWrongNumberOfArgsError",
40
- "BlockingConnectionPool",
41
- "BusyLoadingError",
42
- "ChildDeadlockedError",
43
- "Connection",
44
- "ConnectionError",
45
- "ConnectionPool",
46
- "DataError",
47
- "from_url",
48
- "InvalidResponse",
49
- "PubSubError",
50
- "ReadOnlyError",
51
- "Redis",
52
- "RedisError",
53
- "ResponseError",
54
- "SSLConnection",
55
- "StrictRedis",
56
- "TimeoutError",
57
- "UnixDomainSocketConnection",
58
- "WatchError",
59
- ]
1
+ from aioredis.client import Redis, StrictRedis
2
+ from aioredis.connection import (
3
+ BlockingConnectionPool,
4
+ Connection,
5
+ ConnectionPool,
6
+ SSLConnection,
7
+ UnixDomainSocketConnection,
8
+ )
9
+ from aioredis.exceptions import (
10
+ AuthenticationError,
11
+ AuthenticationWrongNumberOfArgsError,
12
+ BusyLoadingError,
13
+ ChildDeadlockedError,
14
+ ConnectionError,
15
+ DataError,
16
+ InvalidResponse,
17
+ PubSubError,
18
+ ReadOnlyError,
19
+ RedisError,
20
+ ResponseError,
21
+ TimeoutError,
22
+ WatchError,
23
+ )
24
+ from aioredis.utils import from_url
25
+
26
+
27
+ def int_or_str(value):
28
+ try:
29
+ return int(value)
30
+ except ValueError:
31
+ return value
32
+
33
+
34
+ __version__ = "2.0.1"
35
+ VERSION = tuple(map(int_or_str, __version__.split(".")))
36
+
37
+ __all__ = [
38
+ "AuthenticationError",
39
+ "AuthenticationWrongNumberOfArgsError",
40
+ "BlockingConnectionPool",
41
+ "BusyLoadingError",
42
+ "ChildDeadlockedError",
43
+ "Connection",
44
+ "ConnectionError",
45
+ "ConnectionPool",
46
+ "DataError",
47
+ "from_url",
48
+ "InvalidResponse",
49
+ "PubSubError",
50
+ "ReadOnlyError",
51
+ "Redis",
52
+ "RedisError",
53
+ "ResponseError",
54
+ "SSLConnection",
55
+ "StrictRedis",
56
+ "TimeoutError",
57
+ "UnixDomainSocketConnection",
58
+ "WatchError",
59
+ ]