funboost 44.0__py3-none-any.whl → 44.1__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__ = "44.0"
16
+ __version__ = "44.1"
17
17
 
18
18
  from funboost.set_frame_config import show_frame_config
19
19
 
@@ -65,3 +65,4 @@ from funboost.core.current_task import funboost_current_task
65
65
 
66
66
  # 有的包默认没加handlers,原始的日志不漂亮且不可跳转不知道哪里发生的。这里把warnning级别以上的日志默认加上handlers。
67
67
  # nb_log.get_logger(name='', log_level_int=30, _log_filename='pywarning.log')
68
+
@@ -820,7 +820,7 @@ class AbstractConsumer(LoggerLevelSetterMixin, metaclass=abc.ABCMeta, ):
820
820
  self.logger.critical(msg=log_msg)
821
821
  # noinspection PyProtectedMember,PyUnresolvedReferences
822
822
  os._exit(444)
823
- if self.consumer_params.function_timeout == 0:
823
+ if not self.consumer_params.function_timeout :
824
824
  rs = await corotinue_obj
825
825
  # rs = await asyncio.wait_for(corotinue_obj, timeout=4)
826
826
  else:
@@ -103,7 +103,7 @@ def fabric_deploy(booster: Booster, host, port, user, password,
103
103
  process_mark = f'funboost_fabric_mark__{queue_name}__{func_name}'
104
104
  conn = Connection(host, port=port, user=user, connect_kwargs={"password": password}, )
105
105
  kill_shell = f'''ps -aux|grep {process_mark}|grep -v grep|awk '{{print $2}}' |xargs kill -9'''
106
- logger.warning(f'{kill_shell} 命令杀死 {process_mark} 标识的进程')
106
+ logger.warning(f'使用linux命令 {kill_shell} 命令杀死 {process_mark} 标识的进程')
107
107
  # uploader.ssh.exec_command(kill_shell)
108
108
  conn.run(kill_shell, encoding='utf-8', warn=True) # 不想提示,免得烦扰用户以为有什么异常了。所以用上面的paramiko包的ssh.exec_command
109
109
 
@@ -113,7 +113,7 @@ def fabric_deploy(booster: Booster, host, port, user, password,
113
113
  if not extra_shell_str2.endswith(';') and extra_shell_str != '':
114
114
  extra_shell_str2 += ';'
115
115
  shell_str = extra_shell_str2 + shell_str
116
- logger.warning(f'使用语句 {shell_str} 在远程机器 {host} 上启动任务消费')
116
+ logger.warning(f'使用linux命令 {shell_str} 在远程机器 {host} 上启动任务消费')
117
117
  conn.run(shell_str, encoding='utf-8', **invoke_runner_kwargs)
118
118
  # uploader.ssh.exec_command(shell_str)
119
119
 
@@ -125,6 +125,6 @@ def kill_all_remote_tasks(host, port, user, password):
125
125
  uploader = ParamikoFolderUploader(host, port, user, password, '', '')
126
126
  funboost_fabric_mark_all = 'funboost_fabric_mark__'
127
127
  kill_shell = f'''ps -aux|grep {funboost_fabric_mark_all}|grep -v grep|awk '{{print $2}}' |xargs kill -9'''
128
- logger.warning(f'{kill_shell} 命令杀死 {funboost_fabric_mark_all} 标识的进程')
128
+ logger.warning(f'使用linux命令 {kill_shell} 命令杀死 {funboost_fabric_mark_all} 标识的进程')
129
129
  uploader.ssh.exec_command(kill_shell)
130
130
  logger.warning(f'杀死 {host} 机器所有的 {funboost_fabric_mark_all} 标识的进程')
@@ -123,7 +123,7 @@ class BoosterParams(BaseJsonAbleModel):
123
123
  由于有很好用的qps控制运行频率和智能扩大缩小的线程池,此框架建议不需要理会和设置并发数量只需要关心qps就行了,框架的并发是自适应并发数量,这一点很强很好用。"""
124
124
  concurrent_mode: str = ConcurrentModeEnum.THREADING # 并发模式,支持THREADING,GEVENT,EVENTLET,ASYNC,SINGLE_THREAD并发,multi_process_consume 支持协程/线程 叠加多进程并发,性能炸裂.
125
125
  concurrent_num: int = 50 # 并发数量,并发种类由concurrent_mode决定
126
- specify_concurrent_pool: FunboostBaseConcurrentPool = None # 使用指定的线程池/携程池,可以多个消费者共使用一个线程池,节约线程.不为None时候。threads_num失效
126
+ specify_concurrent_pool: typing.Optional[FunboostBaseConcurrentPool] = None # 使用指定的线程池/携程池,可以多个消费者共使用一个线程池,节约线程.不为None时候。threads_num失效
127
127
  specify_async_loop: asyncio.AbstractEventLoop = None # 指定的async的loop循环,设置并发模式为async才能起作用。 有些包例如aiohttp,请求和httpclient的实例化不能处在两个不同的loop中,可以传过来.
128
128
 
129
129
  """qps:
@@ -159,7 +159,7 @@ class BoosterParams(BaseJsonAbleModel):
159
159
  msg_expire_senconds: typing.Union[float, int] = None # 消息过期时间,可以设置消息是多久之前发布的就丢弃这条消息,不运行. 为None则永不丢弃
160
160
 
161
161
  do_task_filtering: bool = False # 是否对函数入参进行过滤去重.
162
- task_filtering_expire_seconds: int = 0 # 任务过滤的失效期,为0则永久性过滤任务。例如设置过滤过期时间是1800秒 , 30分钟前发布过1 + 2 的任务,现在仍然执行,如果是30分钟以内发布过这个任务,则不执行1 + 2
162
+ task_filtering_expire_seconds: int = 0 # 任务过滤的失效期,为0则永久性过滤任务。例如设置过滤过期时间是1800秒 , 30分钟前发布过1 + 2 的任务,现在仍然执行,如果是30分钟以内执行过这个任务,则不执行1 + 2
163
163
 
164
164
  function_result_status_persistance_conf: FunctionResultStatusPersistanceConfig = FunctionResultStatusPersistanceConfig(
165
165
  is_save_result=False, is_save_status=False, expire_seconds=7 * 24 * 3600, is_use_bulk_insert=False) # 是否保存函数的入参,运行结果和运行状态到mongodb。这一步用于后续的参数追溯,任务统计和web展示,需要安装mongo。
@@ -183,7 +183,7 @@ class BoosterParams(BaseJsonAbleModel):
183
183
  broker_exclusive_config: dict = {} # 加上一个不同种类中间件非通用的配置,不同中间件自身独有的配置,不是所有中间件都兼容的配置,因为框架支持30种消息队列,消息队列不仅仅是一般的先进先出queue这么简单的概念,
184
184
  # 例如kafka支持消费者组,rabbitmq也支持各种独特概念例如各种ack机制 复杂路由机制,有的中间件原生能支持消息优先级有的中间件不支持,每一种消息队列都有独特的配置参数意义,可以通过这里传递。每种中间件能传递的键值对可以看consumer类的 BROKER_EXCLUSIVE_CONFIG_DEFAULT
185
185
 
186
- should_check_publish_func_params: bool = True # 消息发布时候是否校验消息发布内容,比如有的人发布消息,函数只接受a,b两个入参,他去传2个入参,或者传参不存在的参数名字, 如果消费函数你非要写*args,**kwargs,那就需要关掉发布消息时候的函数入参检查
186
+ should_check_publish_func_params: bool = True # 消息发布时候是否校验消息发布内容,比如有的人发布消息,函数只接受a,b两个入参,他去传2个入参,或者传参不存在的参数名字, 如果消费函数你非要写*args,**kwargs,那就需要关掉发布消息时候的函数入参检查
187
187
 
188
188
  auto_generate_info: dict = {} # 自动生成的信息,不需要用户主动传参.
189
189
 
@@ -277,3 +277,4 @@ if __name__ == '__main__':
277
277
  # print(PriorityConsumingControlConfig().get_str_dict())
278
278
 
279
279
  print(BoosterParams(queue_name='3213', specify_concurrent_pool=FlexibleThreadPool(100)).json_pre())
280
+ print(PublisherParams.schema_json())