funboost 49.8__py3-none-any.whl → 49.9__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/assist/celery_helper.py +1 -1
- funboost/concurrent_pool/async_pool_executor.py +7 -2
- funboost/constant.py +23 -0
- funboost/consumers/base_consumer.py +12 -7
- funboost/consumers/grpc_consumer.py +102 -0
- funboost/consumers/kafka_consumer.py +4 -2
- funboost/consumers/kafka_consumer_manually_commit.py +7 -2
- funboost/consumers/mysql_cdc_consumer.py +95 -0
- funboost/contrib/cdc/__init__.py +0 -0
- funboost/contrib/cdc/mysql2mysql.py +44 -0
- funboost/core/booster.py +25 -2
- funboost/core/exceptions.py +3 -0
- funboost/core/func_params_model.py +6 -5
- funboost/core/msg_result_getter.py +8 -7
- funboost/factories/broker_kind__publsiher_consumer_type_map.py +10 -1
- funboost/publishers/base_publisher.py +5 -6
- funboost/publishers/grpc_publisher.py +53 -0
- funboost/publishers/kafka_publisher.py +3 -1
- funboost/publishers/mysql_cdc_publisher.py +24 -0
- funboost/timing_job/timing_push.py +3 -1
- {funboost-49.8.dist-info → funboost-49.9.dist-info}/METADATA +69 -33
- {funboost-49.8.dist-info → funboost-49.9.dist-info}/RECORD +27 -30
- funboost/utils/class_utils2.py +0 -94
- funboost/utils/custom_pysnooper.py +0 -149
- funboost/utils/pysnooper_ydf/__init__.py +0 -32
- funboost/utils/pysnooper_ydf/pycompat.py +0 -82
- funboost/utils/pysnooper_ydf/tracer.py +0 -479
- funboost/utils/pysnooper_ydf/utils.py +0 -101
- funboost/utils/pysnooper_ydf/variables.py +0 -133
- funboost/utils/times/__init__.py +0 -85
- funboost/utils/times/version.py +0 -1
- {funboost-49.8.dist-info → funboost-49.9.dist-info}/LICENSE +0 -0
- {funboost-49.8.dist-info → funboost-49.9.dist-info}/WHEEL +0 -0
- {funboost-49.8.dist-info → funboost-49.9.dist-info}/entry_points.txt +0 -0
- {funboost-49.8.dist-info → funboost-49.9.dist-info}/top_level.txt +0 -0
|
@@ -214,9 +214,10 @@ class AbstractPublisher(LoggerLevelSetterMixin, metaclass=abc.ABCMeta, ):
|
|
|
214
214
|
msg, msg_function_kw, extra_params, task_id = self._convert_msg(msg, task_id, priority_control_config)
|
|
215
215
|
t_start = time.time()
|
|
216
216
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
217
|
+
try:
|
|
218
|
+
msg_json = Serialization.to_json_str(msg)
|
|
219
|
+
except Exception as e:
|
|
220
|
+
can_not_json_serializable_keys = Serialization.find_can_not_json_serializable_keys(msg)
|
|
220
221
|
self.logger.warning(f'msg 中包含不能序列化的键: {can_not_json_serializable_keys}')
|
|
221
222
|
# raise ValueError(f'msg 中包含不能序列化的键: {can_not_json_serializable_keys}')
|
|
222
223
|
new_msg = copy.deepcopy(Serialization.to_dict(msg))
|
|
@@ -224,8 +225,6 @@ class AbstractPublisher(LoggerLevelSetterMixin, metaclass=abc.ABCMeta, ):
|
|
|
224
225
|
new_msg[key] = PickleHelper.to_str(new_msg[key])
|
|
225
226
|
new_msg['extra']['can_not_json_serializable_keys'] = can_not_json_serializable_keys
|
|
226
227
|
msg_json = Serialization.to_json_str(new_msg)
|
|
227
|
-
else:
|
|
228
|
-
msg_json = Serialization.to_json_str(msg)
|
|
229
228
|
# print(msg_json)
|
|
230
229
|
decorators.handle_exception(retry_times=10, is_throw_error=True, time_sleep=0.1)(
|
|
231
230
|
self.concrete_realization_of_publish)(msg_json)
|
|
@@ -239,7 +238,7 @@ class AbstractPublisher(LoggerLevelSetterMixin, metaclass=abc.ABCMeta, ):
|
|
|
239
238
|
self.logger.info(
|
|
240
239
|
f'10秒内推送了 {self.count_per_minute} 条消息,累计推送了 {self.publish_msg_num_total} 条消息到 {self._queue_name} 队列中')
|
|
241
240
|
self._init_count()
|
|
242
|
-
return AsyncResult(task_id)
|
|
241
|
+
return AsyncResult(task_id,timeout=self.publisher_params.rpc_timeout)
|
|
243
242
|
|
|
244
243
|
def send_msg(self, msg: typing.Union[dict, str]):
|
|
245
244
|
"""直接发送任意消息内容到消息队列,不生成辅助参数,无视函数入参名字,不校验入参个数和键名"""
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import abc
|
|
2
|
+
from funboost.publishers.base_publisher import AbstractPublisher
|
|
3
|
+
from funboost.assist.grpc_helper import funboost_grpc_pb2_grpc, funboost_grpc_pb2
|
|
4
|
+
from funboost.core.serialization import Serialization
|
|
5
|
+
from funboost.core.function_result_status_saver import FunctionResultStatus
|
|
6
|
+
import grpc
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class GrpcPublisher(AbstractPublisher, ):
|
|
10
|
+
"""grpc 作为broker"""
|
|
11
|
+
|
|
12
|
+
def custom_init(self):
|
|
13
|
+
host = self.publisher_params.broker_exclusive_config['host']
|
|
14
|
+
port = self.publisher_params.broker_exclusive_config['port']
|
|
15
|
+
channel = grpc.insecure_channel(f'{host}:{port}')
|
|
16
|
+
stub = funboost_grpc_pb2_grpc.FunboostBrokerServiceStub(channel)
|
|
17
|
+
self._stub = stub
|
|
18
|
+
self._channel = channel
|
|
19
|
+
|
|
20
|
+
def concrete_realization_of_publish(self, msg: str):
|
|
21
|
+
request = funboost_grpc_pb2.FunboostGrpcRequest(json_req=msg,call_type="publish")
|
|
22
|
+
response = self._stub.Call(request)
|
|
23
|
+
return response.json_resp
|
|
24
|
+
|
|
25
|
+
def sync_call(self, msg_dict: dict, is_return_rpc_data_obj=True):
|
|
26
|
+
"""
|
|
27
|
+
同步请求,并阻塞等待结果返回.
|
|
28
|
+
不像push那样依赖AsyncResult + redis 实现的rpc
|
|
29
|
+
:param msg_dict:
|
|
30
|
+
:return:
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
"""
|
|
34
|
+
用法例子
|
|
35
|
+
$booster.publisher.grpc_call({'x':i,'y':i*2})
|
|
36
|
+
"""
|
|
37
|
+
request = funboost_grpc_pb2.FunboostGrpcRequest(json_req=Serialization.to_json_str(msg_dict),
|
|
38
|
+
call_type="sync_call")
|
|
39
|
+
response = self._stub.Call(request)
|
|
40
|
+
json_resp = response.json_resp
|
|
41
|
+
if is_return_rpc_data_obj:
|
|
42
|
+
return FunctionResultStatus.parse_status_and_result_to_obj(Serialization.to_dict(json_resp))
|
|
43
|
+
else:
|
|
44
|
+
return Serialization.to_dict(json_resp)
|
|
45
|
+
|
|
46
|
+
def clear(self):
|
|
47
|
+
pass
|
|
48
|
+
|
|
49
|
+
def get_message_count(self):
|
|
50
|
+
return -1
|
|
51
|
+
|
|
52
|
+
def close(self):
|
|
53
|
+
self._channel.close()
|
|
@@ -20,7 +20,9 @@ class KafkaPublisher(AbstractPublisher, ):
|
|
|
20
20
|
self._producer = KafkaPythonImporter().KafkaProducer(bootstrap_servers=BrokerConnConfig.KAFKA_BOOTSTRAP_SERVERS)
|
|
21
21
|
self._admin_client = KafkaPythonImporter().KafkaAdminClient(bootstrap_servers=BrokerConnConfig.KAFKA_BOOTSTRAP_SERVERS)
|
|
22
22
|
try:
|
|
23
|
-
self._admin_client.create_topics([KafkaPythonImporter().NewTopic(self._queue_name,
|
|
23
|
+
self._admin_client.create_topics([KafkaPythonImporter().NewTopic(self._queue_name,
|
|
24
|
+
self.publisher_params.broker_exclusive_config['num_partitions'],
|
|
25
|
+
self.publisher_params.broker_exclusive_config['replication_factor'])])
|
|
24
26
|
# admin_client.create_partitions({self._queue_name: NewPartitions(total_count=16)})
|
|
25
27
|
except KafkaPythonImporter().TopicAlreadyExistsError:
|
|
26
28
|
pass
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
from funboost.publishers.base_publisher import AbstractPublisher
|
|
4
|
+
|
|
5
|
+
class MysqlCdcPublisher(AbstractPublisher):
|
|
6
|
+
"""
|
|
7
|
+
A placeholder publisher for the CDC broker.
|
|
8
|
+
Publishing is handled automatically by the consumer by listening to binlog events.
|
|
9
|
+
Direct publishing is not supported and will raise an error.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
def concrete_realization_of_publish(self, msg: str):
|
|
13
|
+
raise NotImplementedError("The 'funboost_cdc' broker does not support manual publishing. "
|
|
14
|
+
"Tasks are generated automatically from database changes.")
|
|
15
|
+
|
|
16
|
+
def clear(self):
|
|
17
|
+
self.logger.warning("The 'funboost_cdc' broker does not have a queue to clear.")
|
|
18
|
+
pass
|
|
19
|
+
|
|
20
|
+
def get_message_count(self):
|
|
21
|
+
return -1 # Not applicable
|
|
22
|
+
|
|
23
|
+
def close(self):
|
|
24
|
+
pass
|
|
@@ -45,7 +45,9 @@ class ApsJobAdder:
|
|
|
45
45
|
@classmethod
|
|
46
46
|
def get_funboost_redis_apscheduler(cls, queue_name):
|
|
47
47
|
"""
|
|
48
|
-
|
|
48
|
+
每个队列名字的定时任务有自己单独的 aspchedule r定时器,
|
|
49
|
+
每隔定时器用不同的redis jobstore的 jobs_key 和 run_times_key,防止互相干扰和取出不属于自己的任务.
|
|
50
|
+
如果所有函数使用同一个定时器和一个jobs_key ,当用户只想运行f1定时任务,如果用户把f2删了,或者不需要运行f2定时任务,那就报错或者不方便.
|
|
49
51
|
"""
|
|
50
52
|
if queue_name in cls.queue__redis_aps_map:
|
|
51
53
|
return cls.queue__redis_aps_map[queue_name]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: funboost
|
|
3
|
-
Version: 49.
|
|
3
|
+
Version: 49.9
|
|
4
4
|
Summary: pip install funboost,python全功能分布式函数调度框架,funboost的功能是全面性重量级,用户能想得到的功能99%全都有;funboost的使用方式是轻量级,只有@boost一行代码需要写。支持python所有类型的并发模式和一切知名消息队列中间件,支持如 celery dramatiq等框架整体作为funboost中间件,python函数加速器,框架包罗万象,用户能想到的控制功能全都有。一统编程思维,兼容50% python业务场景,适用范围广。只需要一行代码即可分布式执行python一切函数,funboost web manager 方便查看和管理消费函数;99%用过funboost的pythoner 感受是 简易 方便 强劲 强大,相见恨晚
|
|
5
5
|
Home-page: https://github.com/ydf0509/funboost
|
|
6
6
|
Author: bfzs
|
|
@@ -83,6 +83,10 @@ Requires-Dist: pyzmq; extra == "all"
|
|
|
83
83
|
Requires-Dist: kafka-python==2.0.2; extra == "all"
|
|
84
84
|
Requires-Dist: eventlet==0.33.3; extra == "all"
|
|
85
85
|
Requires-Dist: gevent==22.10.2; extra == "all"
|
|
86
|
+
Requires-Dist: mysql-replication==1.0.9; extra == "all"
|
|
87
|
+
Requires-Dist: grpcio==1.60.0; extra == "all"
|
|
88
|
+
Requires-Dist: grpcio-tools==1.60.0; extra == "all"
|
|
89
|
+
Requires-Dist: protobuf==4.25.1; extra == "all"
|
|
86
90
|
Requires-Dist: flask; extra == "all"
|
|
87
91
|
Requires-Dist: flask_bootstrap; extra == "all"
|
|
88
92
|
Requires-Dist: flask_wtf; extra == "all"
|
|
@@ -113,6 +117,10 @@ Requires-Dist: pyzmq; extra == "extra-brokers"
|
|
|
113
117
|
Requires-Dist: kafka-python==2.0.2; extra == "extra-brokers"
|
|
114
118
|
Requires-Dist: eventlet==0.33.3; extra == "extra-brokers"
|
|
115
119
|
Requires-Dist: gevent==22.10.2; extra == "extra-brokers"
|
|
120
|
+
Requires-Dist: mysql-replication==1.0.9; extra == "extra-brokers"
|
|
121
|
+
Requires-Dist: grpcio==1.60.0; extra == "extra-brokers"
|
|
122
|
+
Requires-Dist: grpcio-tools==1.60.0; extra == "extra-brokers"
|
|
123
|
+
Requires-Dist: protobuf==4.25.1; extra == "extra-brokers"
|
|
116
124
|
Provides-Extra: flask
|
|
117
125
|
Requires-Dist: flask; extra == "flask"
|
|
118
126
|
Requires-Dist: flask_bootstrap; extra == "flask"
|
|
@@ -182,45 +190,65 @@ funboost的旧框架名字是function_scheduling_distributed_framework , 关系
|
|
|
182
190
|
|
|
183
191
|
## 1.0 github地址和文档地址
|
|
184
192
|
|
|
185
|
-
### 1.0.1
|
|
193
|
+
### 1.0.1 分布式函数调度框架文档地址
|
|
186
194
|
|
|
187
195
|
[查看分布式函数调度框架文档 https://funboost.readthedocs.io/zh-cn/latest/index.html](https://funboost.readthedocs.io/zh-cn/latest/index.html)
|
|
188
196
|
|
|
189
|
-
|
|
197
|
+
文档很长,大部分都是讲原理和对比各种框架,不仅仅 `how` to use,更多的是 `What` & `Why`。
|
|
198
|
+
但是用户只需要学习1.3这1个例子就能掌握了。因为其他例子只是 @boost的 BoosterParams 里面的控制入参换了一下。
|
|
199
|
+
|
|
190
200
|
|
|
191
201
|
用户只需要专门看 BoosterParams 里面的每个入参的注释就能掌握框架了,因为funboost只有@boost一行代码需要你写。
|
|
192
202
|
|
|
193
203
|
funboost 框架和一般的框架不一样,因为只有一行代码需要掌握,绝对不是要求用户先精通框架本身才能自由发挥。
|
|
194
204
|
|
|
195
|
-
#### [1.python万能分布式函数调度框架简funboost简介](https://funboost.readthedocs.io/zh-cn/latest/articles/c1.html)
|
|
196
|
-
|
|
197
|
-
#### [2. funboost对比celery框架](https://funboost.readthedocs.io/zh-cn/latest/articles/c2.html)
|
|
198
|
-
|
|
199
|
-
#### [3.funboost框架详细介绍](https://funboost.readthedocs.io/zh-cn/latest/articles/c3.html)
|
|
200
|
-
|
|
201
|
-
#### [4.funboost使用框架的各种代码示例](https://funboost.readthedocs.io/zh-cn/latest/articles/c4.html)
|
|
202
|
-
|
|
203
|
-
#### [4b.funboost使用框架的各种代码示例(高级进阶)](https://funboost.readthedocs.io/zh-cn/latest/articles/c4b.html)
|
|
204
|
-
|
|
205
|
-
#### [5.funboost框架运行时截图](https://funboost.readthedocs.io/zh-cn/latest/articles/c5.html)
|
|
206
|
-
|
|
207
|
-
#### [6.funboost常见问题回答](https://funboost.readthedocs.io/zh-cn/latest/articles/c6.html)
|
|
208
|
-
|
|
209
|
-
#### [7.funboost更新记录](https://funboost.readthedocs.io/zh-cn/latest/articles/c7.html)
|
|
210
|
-
|
|
211
|
-
#### [8.funboost是万能函数调度框架,当然可以爬虫,自由编程 降维打击 框架奴役](https://funboost.readthedocs.io/zh-cn/latest/articles/c8.html)
|
|
212
205
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
206
|
+
[**1.python万能分布式函数调度框架简funboost简介**](https://funboost.readthedocs.io/zh-cn/latest/articles/c1.html)
|
|
207
|
+
|
|
208
|
+
##### 2. funboost对比celery框架
|
|
209
|
+
[**2.funboost对比celery框架**](https://funboost.readthedocs.io/zh-cn/latest/articles/c2.html)
|
|
210
|
+
[2.funboost对比celery框架](https://funboost.readthedocs.io/zh-cn/latest/articles/c2.html)
|
|
211
|
+
[**3.funboost框架详细介绍**](https://funboost.readthedocs.io/zh-cn/latest/articles/c3.html)
|
|
212
|
+
##### 3.funboost框架详细介绍
|
|
213
|
+
[**4.funboost使用框架的各种代码示例**](https://funboost.readthedocs.io/zh-cn/latest/articles/c4.html)
|
|
214
|
+
[3.funboost框架详细介绍](https://funboost.readthedocs.io/zh-cn/latest/articles/c3.html)
|
|
215
|
+
[**4b.funboost使用框架的各种代码示例(高级进阶)**](https://funboost.readthedocs.io/zh-cn/latest/articles/c4b.html)
|
|
216
|
+
##### 4.funboost使用框架的各种代码示例
|
|
217
|
+
[4.funboost使用框架的各种代码示例](https://funboost.readthedocs.io/zh-cn/latest/articles/c4.html)
|
|
218
|
+
[**5.funboost框架运行时截图**](https://funboost.readthedocs.io/zh-cn/latest/articles/c5.html)
|
|
219
|
+
##### 4b.funboost使用框架的各种代码示例(高级进阶)
|
|
220
|
+
[4b.funboost使用框架的各种代码示例(高级进阶)](https://funboost.readthedocs.io/zh-cn/latest/articles/c4b.html)
|
|
221
|
+
[**6.funboost常见问题回答**](https://funboost.readthedocs.io/zh-cn/latest/articles/c6.html)
|
|
222
|
+
##### 5.funboost框架运行时截图
|
|
223
|
+
[5.funboost框架运行时截图](https://funboost.readthedocs.io/zh-cn/latest/articles/c5.html)
|
|
224
|
+
[**7.funboost更新记录**](https://funboost.readthedocs.io/zh-cn/latest/articles/c7.html)
|
|
225
|
+
##### 6.funboost常见问题回答
|
|
226
|
+
[6.funboost常见问题回答](https://funboost.readthedocs.io/zh-cn/latest/articles/c6.html)
|
|
227
|
+
[**8.funboost是万能函数调度框架,当然可以爬虫,自由编程 降维打击 框架奴役**](https://funboost.readthedocs.io/zh-cn/latest/articles/c8.html)
|
|
228
|
+
##### 7.funboost更新记录
|
|
229
|
+
[7.funboost更新记录](https://funboost.readthedocs.io/zh-cn/latest/articles/c7.html)
|
|
230
|
+
[**9.轻松远程服务器部署运行函数**](https://funboost.readthedocs.io/zh-cn/latest/articles/c9.html#)
|
|
231
|
+
##### 8.funboost是万能函数调度框架,当然可以爬虫,自由编程 降维打击 框架奴役
|
|
232
|
+
[8.funboost是万能函数调度框架,当然可以爬虫,自由编程 降维打击 框架奴役](https://funboost.readthedocs.io/zh-cn/latest/articles/c8.html)
|
|
233
|
+
[**10.python3.6-3.12 安装/使用funboost出错问题反馈**](https://funboost.readthedocs.io/zh-cn/latest/articles/c10.html)
|
|
234
|
+
##### 9.轻松远程服务器部署运行函数
|
|
235
|
+
[9.轻松远程服务器部署运行函数](https://funboost.readthedocs.io/zh-cn/latest/articles/c9.html#)
|
|
236
|
+
[**11.funboost 使用某些中间件或三方任务队列框架作为broker的例子(包括celery框架)。**](https://funboost.readthedocs.io/zh-cn/latest/articles/c11.html)
|
|
237
|
+
##### 10.python3.6-3.12 安装/使用funboost出错问题反馈
|
|
238
|
+
[10.python3.6-3.12 安装/使用funboost出错问题反馈](https://funboost.readthedocs.io/zh-cn/latest/articles/c10.html)
|
|
239
|
+
[**12.funboost 控制台支持命令行**](https://funboost.readthedocs.io/zh-cn/latest/articles/c12.html)
|
|
240
|
+
##### 11.funboost 使用某些中间件或三方任务队列框架作为broker的例子(包括celery框架)。
|
|
241
|
+
[11.funboost 使用某些中间件或三方任务队列框架作为broker的例子(包括celery框架)。](https://funboost.readthedocs.io/zh-cn/latest/articles/c11.html)
|
|
242
|
+
[**13.启动 funboost web manager,查看消费结果和队列管理**](https://funboost.readthedocs.io/zh-cn/latest/articles/c13.html)
|
|
243
|
+
##### 12.funboost 控制台支持命令行
|
|
244
|
+
[12.funboost 控制台支持命令行](https://funboost.readthedocs.io/zh-cn/latest/articles/c12.html)
|
|
245
|
+
|
|
246
|
+
##### 13.启动 funboost web manager,查看消费结果和队列管理
|
|
247
|
+
[13.启动 funboost web manager,查看消费结果和队列管理](https://funboost.readthedocs.io/zh-cn/latest/articles/c13.html)
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
#### funboost依赖的nb_log日志文档
|
|
251
|
+
[funboost依赖的nb_log日志文档 https://nb-log-doc.readthedocs.io/zh_CN/latest/articles/c9.html#id2](https://nb-log-doc.readthedocs.io/zh_CN/latest/articles/c9.html#id2)
|
|
224
252
|
|
|
225
253
|
```
|
|
226
254
|
文档很长,但归根结底只需要学习 1.3 里面的这1个例子就行,主要是修改下@boost的各种参数,
|
|
@@ -234,7 +262,7 @@ funboost 框架和一般的框架不一样,因为只有一行代码需要掌
|
|
|
234
262
|
很多新手需要小心翼翼模仿网上说的项目目录结构,以为不按照那么规划目录和命名就玩不起来,本身说明celery很坑。
|
|
235
263
|
```
|
|
236
264
|
|
|
237
|
-
### 1.0.2
|
|
265
|
+
### 1.0.2 分布式函数调度框架github地址
|
|
238
266
|
|
|
239
267
|
[查看分布式函数调度框架github项目](https://github.com/ydf0509/funboost)
|
|
240
268
|
|
|
@@ -489,8 +517,14 @@ win cmd和linux 运行时候,设置 PYTHONPATH 为项目根目录,是为了
|
|
|
489
517
|
而是根据实际情况函数的参数个数、函数的内部逻辑功能,全部都由用户自定义,函数里面想写什么就写什么,想干什么就干什么,极端自由。
|
|
490
518
|
也就是框架很容易学和使用,把下面的task_fun函数的入参和内部逻辑换成你自己想写的函数功能就可以了,框架只需要学习boost这一个函数的参数就行。
|
|
491
519
|
测试使用的时候函数里面加上sleep模拟阻塞,从而更好的了解框架的并发和各种控制功能。
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
```
|
|
523
|
+
有一点要说明的是框架的消息中间件的ip 端口 密码 等配置是在你第一次运行代码时候,在你当前项目的根目录下生成的 funboost_config.py 按需设置 (默认放在项目根目录是为了方便利用项目的 PYTHONPATH。当然,只要 PYTHONPATH 设置正确,
|
|
524
|
+
该配置文件可以放在磁盘的任意文件夹里面。用户可以看教程 6.18.3 问答章节)。
|
|
492
525
|
|
|
493
|
-
|
|
526
|
+
funboost_config.py 里面仅仅是配置 中间件连接,例如ip 端口这些简单的配置, 只需要第一次配置正确即可,
|
|
527
|
+
后续的开发中基本无需再次修改此文件。 因为所有消费函数任务控制功能都是在 BoosterParams 中传参。
|
|
494
528
|
```
|
|
495
529
|
|
|
496
530
|
### 1.3.1 funboost最简单例子
|
|
@@ -686,7 +720,9 @@ def task_fun(a: int, b: int):
|
|
|
686
720
|
队列操作,查看消费者详情:查看队列的所有消费者详情
|
|
687
721
|
[](https://imgse.com/i/pEJCgT1)
|
|
688
722
|
|
|
723
|
+
|
|
689
724
|
队列操作:查看消费曲线图,查看各种消费指标。
|
|
725
|
+
包括 历史运行次数 历史运行失败次数 近10秒完成 近10秒失败 近10秒函数运行平均耗时 累计函数运行平均耗时 剩余消息数量
|
|
690
726
|
[](https://imgse.com/i/pVpr7sP)
|
|
691
727
|
|
|
692
728
|
rpc调用:在网页上对30种消息队列发布消息并获取消息的函数执行结;根据taskid获取结果。
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
funboost/__init__.py,sha256=
|
|
1
|
+
funboost/__init__.py,sha256=oqXgXIvk7ndaGLbYMEubwcoAQUqjpU3MXUT3K3eEuUw,4093
|
|
2
2
|
funboost/__init__old.py,sha256=9Kv3cPLnPkbzMRnuJFVkPsuDdx1CdcSIuITkpdncZSc,20382
|
|
3
3
|
funboost/__main__.py,sha256=BetXBv7PkVeeK-UENiFq_KEEIzvObMI0rd8S1DHRdLU,1139
|
|
4
|
-
funboost/constant.py,sha256=
|
|
4
|
+
funboost/constant.py,sha256=tgoui4EVwnAMMzA9qshqyRKS1oi90bYcFVNu0Ss_Jc4,14895
|
|
5
5
|
funboost/funboost_config_deafult.py,sha256=9kbX6rmxcKp2CxNZoGpNYVVQNI48XjE4xJrEz6q61qo,6795
|
|
6
6
|
funboost/set_frame_config.py,sha256=U-2_02JYyT8N8v2juZLwbUSCHJPo-hyDOiK5Zz_4J8s,14552
|
|
7
7
|
funboost/assist/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
-
funboost/assist/celery_helper.py,sha256=
|
|
8
|
+
funboost/assist/celery_helper.py,sha256=COMCoCM1oagcnOTaYEyKXwJTiNW0kkbKLp5TB_JvxCc,6518
|
|
9
9
|
funboost/assist/dramatiq_helper.py,sha256=9mUyfBMAJXzwvB8LwOmapn3rY30a6UXt3tNOfL6OXoM,2106
|
|
10
10
|
funboost/assist/faststream_helper.py,sha256=BmBaFsvsjQK2SO71ulHRsEwO28uYZm2uMMvXkHzLi1E,631
|
|
11
11
|
funboost/assist/huey_helper.py,sha256=PuJHIzK5oRd5RzbuxLMHhWlkKO3J-ObRK0mrMs_iQWs,1770
|
|
@@ -16,7 +16,7 @@ funboost/assist/taskiq_helper.py,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPja
|
|
|
16
16
|
funboost/beggar_version_implementation/beggar_redis_consumer.py,sha256=vXb1c2B-edcENqxU41CEYz0T8zdUcaGu9wBhDc4KPok,4037
|
|
17
17
|
funboost/concurrent_pool/__init__.py,sha256=C27xYXj7c1NGuVeG7K2LxKH7JKnGwfPfITyon6xFaoE,803
|
|
18
18
|
funboost/concurrent_pool/async_helper.py,sha256=Q2EVZeS_A29-S6i9VszC6HNNW-RkICF8v3t_9GJMwFw,3942
|
|
19
|
-
funboost/concurrent_pool/async_pool_executor.py,sha256=
|
|
19
|
+
funboost/concurrent_pool/async_pool_executor.py,sha256=bDOA0unmjwvbv07iZ7IZHw_amsuIcKLSJkbhQOU_zA4,7892
|
|
20
20
|
funboost/concurrent_pool/base_pool_type.py,sha256=h3xcadufMAf49CoNe5VkUyIxlniMeNtDjadqB5IsiKA,194
|
|
21
21
|
funboost/concurrent_pool/bounded_processpoolexcutor_gt_py37.py,sha256=pWqpKAP0Z0cuHdSHJ5ti6EpNndnIoYkPE6IOl4BvbJw,4775
|
|
22
22
|
funboost/concurrent_pool/bounded_processpoolexcutor_py36.py,sha256=CMRSjwnUAhNT2fj44SVNEYRehprlxjQADYkgw9hTVlw,3063
|
|
@@ -36,23 +36,25 @@ funboost/concurrent_pool/backup/async_pool_executor_back.py,sha256=x0pyPgxzTENOs
|
|
|
36
36
|
funboost/concurrent_pool/backup/async_pool_executor_janus.py,sha256=OHMWJ9l3EYTpPpcrPrGGKd4K0tmQ2PN8HiX0Dta0EOo,5728
|
|
37
37
|
funboost/concurrent_pool/backup/grok_async_pool.py,sha256=3DgyB2aT0iHakb-pxd51WRKGIF7EKNNcX_ogDTF2hik,5825
|
|
38
38
|
funboost/consumers/__init__.py,sha256=ZXY_6Kut1VYNQiF5aWEgIWobsW1ht9YUP0TdRZRWFqI,126
|
|
39
|
-
funboost/consumers/base_consumer.py,sha256=
|
|
39
|
+
funboost/consumers/base_consumer.py,sha256=WNK3oglt4QHI3A8r4T0gtgrZijJzup4thOnKcsYACA4,88687
|
|
40
40
|
funboost/consumers/celery_consumer.py,sha256=6BPZa2O36BQFVu7uWuuFCfJTTaw-36DJJPSpvEbamU8,9371
|
|
41
41
|
funboost/consumers/confirm_mixin.py,sha256=5xC9AAQr_MY4tbSed8U-M6tOVmh69Qv9X0ld0JLT9Tk,6185
|
|
42
42
|
funboost/consumers/dramatiq_consumer.py,sha256=ozmeAfeF0U-YNYHK4suQB0N264h5AZdfMH0O45Mh-8A,2229
|
|
43
43
|
funboost/consumers/empty_consumer.py,sha256=qbkQX2Qlw2Wm8dFEJqjSEEvTA-uh184sqQbFo_5EOiI,1501
|
|
44
44
|
funboost/consumers/faststream_consumer.py,sha256=_LoQ3hA1KBooUJUVtCc4fmEUptLty_hC7XGSnO7DJAs,2306
|
|
45
|
+
funboost/consumers/grpc_consumer.py,sha256=8y5Sl7x_S9ZI1rryePLta73TMMuEeasSRReaZnS5SIU,4058
|
|
45
46
|
funboost/consumers/http_consumer.py,sha256=TlyCpjPFWdE-KIPdIhMdmAKNH8dHXIcRwrSH9NmDRQc,2499
|
|
46
47
|
funboost/consumers/http_consumer000.py,sha256=PiiSLSQB-hHgS1vAn8DoHD2siC3zO6_kKjVW0g6AFIc,4379
|
|
47
48
|
funboost/consumers/httpsqs_consumer.py,sha256=kaqOcrKMLrSR27XqeiheRDmpF1KDVDghgbHcefTjqt8,1171
|
|
48
49
|
funboost/consumers/huey_consumer.py,sha256=cW10ZPxdZQzUuJwdqQpJIRPTj2vCbZS0uXFJ7L8bpa4,1843
|
|
49
|
-
funboost/consumers/kafka_consumer.py,sha256=
|
|
50
|
-
funboost/consumers/kafka_consumer_manually_commit.py,sha256=
|
|
50
|
+
funboost/consumers/kafka_consumer.py,sha256=jdQ2A0rwWJfWFLTjGknmDixi1EkjHx9Ra8VG_KD0Dyg,4637
|
|
51
|
+
funboost/consumers/kafka_consumer_manually_commit.py,sha256=XbExZKewuxt-z8JFo_yV9yjjw7rDbTK0F20V84Y6E_A,9929
|
|
51
52
|
funboost/consumers/kombu_consumer.py,sha256=ZbzCiKQDZtbD_aK7aWxSvzARYjNuHVlyef4Feb4R7q0,7938
|
|
52
53
|
funboost/consumers/local_python_queue_consumer.py,sha256=4Cel1WaNwbRpDux22USP8is5R9__A_-LlqyHjcw02Z4,1160
|
|
53
54
|
funboost/consumers/memory_deque_consumer.py,sha256=tTwOkrB9GdySOQstVLnU4hnBnap6rafCeoXhmV0TI5c,1110
|
|
54
55
|
funboost/consumers/mongomq_consumer.py,sha256=e1Cupe-Cb2LUuJlQhER6NecrvK7FyzKKZ2HxyfOI-OY,1119
|
|
55
56
|
funboost/consumers/mqtt_consumer.py,sha256=iLWKxe0CjKHUYrE6YMWNJHto0tD3siUAvZl9ssNsz_s,2297
|
|
57
|
+
funboost/consumers/mysql_cdc_consumer.py,sha256=bIHqiEZhJyUYwfIT3QXdHWI_ipHhzIUOh7ZCMTd9m3E,4059
|
|
56
58
|
funboost/consumers/nameko_consumer.py,sha256=Qhl2FmrIjzjXLkIdMLQdhZ8GmrhiuoEss7cwGHCFT7c,2213
|
|
57
59
|
funboost/consumers/nats_consumer.py,sha256=yv_8SC4zdw5UXBpYooFMXHaC-mNzws5IK0woxHWr1NM,1119
|
|
58
60
|
funboost/consumers/nsq_consumer.py,sha256=KcP4wT656LyvuwyQXnVp0B6DwYvnZ6z_Vyzt0KjHAQc,1518
|
|
@@ -85,22 +87,24 @@ funboost/contrib/django_db_deco.py,sha256=RJaRUYdVqS10gWqM4Ncs0Lngox52SUaqIIn5GK
|
|
|
85
87
|
funboost/contrib/queue2queue.py,sha256=4-28ULM7PTbmbOw8DG9rjlMUQCDkJNcUqkmdHAkGg2c,4898
|
|
86
88
|
funboost/contrib/redis_consume_latest_msg_broker.py,sha256=ESortBZ2qu_4PBCa3e3FeL2k_PClZNb74_v55HV-BOg,1902
|
|
87
89
|
funboost/contrib/save_result_status_to_sqldb.py,sha256=AxvD7nHs4sjr9U0kwEZzyPKrsGdU_JzEgzzhh_V1_4w,4071
|
|
90
|
+
funboost/contrib/cdc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
91
|
+
funboost/contrib/cdc/mysql2mysql.py,sha256=J7jLHTB27WO3iMMNU4s556b_p0x51dgnCz5c7eVWtKk,2317
|
|
88
92
|
funboost/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
89
93
|
funboost/core/active_cousumer_info_getter.py,sha256=vd7yja7o0d77DhRj_h052Gh4V_72W6BpTBFFlD22KMA,15252
|
|
90
|
-
funboost/core/booster.py,sha256=
|
|
94
|
+
funboost/core/booster.py,sha256=E5Ler0JrA9egB0E-frN8-vwygrB9f8L_5ErUN6WoElM,21506
|
|
91
95
|
funboost/core/current_task.py,sha256=6f7IbGZaSnojVxIeyXPkk5LE2yUiRRTJBjTNqwLL2WU,7270
|
|
92
|
-
funboost/core/exceptions.py,sha256=
|
|
96
|
+
funboost/core/exceptions.py,sha256=twp5eAUCds3sWh3Ar7WVNhCn3y_TFqb-Ajwbjb9scGU,1564
|
|
93
97
|
funboost/core/fabric_deploy_helper.py,sha256=foieeqlNySuU9axJzNF6TavPjIUSYBx9UO3syVKUiyY,9999
|
|
94
98
|
funboost/core/funboost_config_getter.py,sha256=b5nAdAmUxahskY-ohB7ptf2gKywFlDA0Fq1cWroxxbs,384
|
|
95
99
|
funboost/core/funboost_time.py,sha256=a0MacbUBfYk8mf7D3UUyCxH5QJsu8YiGVXwJqPnSQH0,1779
|
|
96
|
-
funboost/core/func_params_model.py,sha256=
|
|
100
|
+
funboost/core/func_params_model.py,sha256=d9hlS-FYzAELDYkdZUPRpgoRSjlTDy4x2hN2Mhz0Q7M,24842
|
|
97
101
|
funboost/core/function_result_status_config.py,sha256=PyjqAQOiwsLt28sRtH-eYRjiI3edPFO4Nde0ILFRReE,1764
|
|
98
102
|
funboost/core/function_result_status_saver.py,sha256=PtaSgxPdsmv1fhmVgZ75RG5rJwE3d7SSWhcVVim-EsM,9865
|
|
99
103
|
funboost/core/helper_funs.py,sha256=SsMa7A3iJyLek6v1qRK02kINebDp6kuAmlYkrYLXwQ0,2369
|
|
100
104
|
funboost/core/kill_remote_task.py,sha256=lfclwtNhMDGLKX2UCpK_wyhnKPKkoxCZxesRA6KHOrc,8186
|
|
101
105
|
funboost/core/lazy_impoter.py,sha256=yyJqwmbJziMfRTESn9magqso-_8ppl8yzHFCS5qzxkI,5104
|
|
102
106
|
funboost/core/loggers.py,sha256=YY69MAP_o0Eq-CHp5UNWrKDYpoJsiHZ92E2i_fxcxRI,2358
|
|
103
|
-
funboost/core/msg_result_getter.py,sha256=
|
|
107
|
+
funboost/core/msg_result_getter.py,sha256=dhbiTDibjUxcFnmiP6gPVZn1DksyHLCdyTGmFJNQVkE,11721
|
|
104
108
|
funboost/core/muliti_process_enhance.py,sha256=tI3178inc5sqPh-jQc0XaTuUD1diIZyHuukBRk1Gp6Y,3595
|
|
105
109
|
funboost/core/serialization.py,sha256=-5YdIppOSx81xaOXCryZa2nsmJ-Ro3pfV6yePcbkoEA,1240
|
|
106
110
|
funboost/core/task_id_logger.py,sha256=lR19HQcX6Pp8laURCD656xNpF_JP6nLB3zUKI69EWzE,864
|
|
@@ -109,7 +113,7 @@ funboost/core/cli/discovery_boosters.py,sha256=mbEyv0bUIGcmgkfXLI_Q1IK1QvVwKyro8
|
|
|
109
113
|
funboost/core/cli/funboost_cli_user_templ.py,sha256=XUpKLxRKtYfebPUM8wii64kB0HW8L7j9LnRpT0xCfQI,2243
|
|
110
114
|
funboost/core/cli/funboost_fire.py,sha256=n2Zny_UJ7zx4kRXD_YzNBHqdHMc7n0SE7gL28tuwiPU,5387
|
|
111
115
|
funboost/factories/__init__.py,sha256=s7kKKjR1HU5eMjPD6r5b-SXTVMo1zBp2JjOAtkyt5Yo,178
|
|
112
|
-
funboost/factories/broker_kind__publsiher_consumer_type_map.py,sha256
|
|
116
|
+
funboost/factories/broker_kind__publsiher_consumer_type_map.py,sha256=XqrCglQYpVCVUiKTFaHIQBjHqObBYrGOqIvBtBqQc54,10784
|
|
113
117
|
funboost/factories/consumer_factory.py,sha256=3RbdcH5fNAnumDkZhtRpDP7RsfJw50NLCgl_-YgJclE,1494
|
|
114
118
|
funboost/factories/publisher_factotry.py,sha256=W5giVsQnT6pHRIC6nRANj0-XBovkuzkl0Zqcb4u5o_U,2529
|
|
115
119
|
funboost/function_result_web/app.py,sha256=umXTsGbL-uMFJJoMuALZoUc5d3XZ1SynUV-Lz_w0fZY,14117
|
|
@@ -170,22 +174,24 @@ funboost/function_result_web/templates/rpc_call.html,sha256=qFznWysEFTvJKUQYqnJa
|
|
|
170
174
|
funboost/function_result_web/templates/running_consumer_by_ip.html,sha256=2Rcxbi80c1JEIRCnNe1MG55axdb0vBlkB6yL9rxw53c,10248
|
|
171
175
|
funboost/function_result_web/templates/running_consumer_by_queue_name.html,sha256=r5EYlfp0fE8RFWzI0k3K571EUmirwcPX9NdnSEfAWiQ,10301
|
|
172
176
|
funboost/publishers/__init__.py,sha256=xqBHlvsJQVPfbdvP84G0LHmVB7-pFBS7vDnX1Uo9pVY,131
|
|
173
|
-
funboost/publishers/base_publisher.py,sha256=
|
|
177
|
+
funboost/publishers/base_publisher.py,sha256=m3emfrFpvNYF1J-axSHH6kIY5CATzdIzfiC6P1ics_s,18806
|
|
174
178
|
funboost/publishers/celery_publisher.py,sha256=uc9N1uLW74skUCw8dsnvxORM2O3cy4SiI7tUZRmvkHA,2336
|
|
175
179
|
funboost/publishers/celery_publisher000.py,sha256=2XLOyU2__vlIUTi5L15uf0BJqAIjxbc3kCLIRDSOY9w,3966
|
|
176
180
|
funboost/publishers/confluent_kafka_publisher.py,sha256=B4rF6gljixOMyN6L2eL1gzqTv97uoy7TTzgKUhHljEQ,4749
|
|
177
181
|
funboost/publishers/dramatiq_publisher.py,sha256=IH9F-Ps1r94WDu2a7cZbJqWlBgblDbEcpjGj2rl-9WE,1413
|
|
178
182
|
funboost/publishers/empty_publisher.py,sha256=Com5m-mkjXpcWxKZZneymhLNaRJNaGAtvwjhwHmECgg,870
|
|
179
183
|
funboost/publishers/faststream_publisher.py,sha256=TS_hFDZ4Q1HGyGJ_3D9m9SroUOmMo-f2hCMTyuEoEIU,2303
|
|
184
|
+
funboost/publishers/grpc_publisher.py,sha256=kQ8c9VMmFXXwMz0-KyDV8VWKeAzZ20pp6KrI3rZmbRQ,1967
|
|
180
185
|
funboost/publishers/http_publisher.py,sha256=1uzPXG7ExAAwOs35I-goXTi-CuZij_maRIMxc-mqvq8,1048
|
|
181
186
|
funboost/publishers/httpsqs_publisher.py,sha256=PS6h8-mn3wYFfMOsPt4tal8p0yZgYgrYYO9ZnIl9CwU,2737
|
|
182
187
|
funboost/publishers/huey_publisher.py,sha256=9HBrsqTO61iPB1nI5fYOQNPuOaX4I4Wmb1BRNODAE_0,1118
|
|
183
|
-
funboost/publishers/kafka_publisher.py,sha256=
|
|
188
|
+
funboost/publishers/kafka_publisher.py,sha256=psjQbOmjpNHZNxyo14a09XsO0JLSSPPaBLc5mLUJTRI,2343
|
|
184
189
|
funboost/publishers/kombu_publisher.py,sha256=Z0JKF_-xKJSTc21jqhIwphDUHUPO2X3wVojt-rHhDlM,5415
|
|
185
190
|
funboost/publishers/local_python_queue_publisher.py,sha256=292NKW7X4MCMMPvfMDb-6_BdA997lda7-lOlODIAaOY,3477
|
|
186
191
|
funboost/publishers/meomory_deque_publisher.py,sha256=0q6WKQ8ohnhlXDgXkxWGsImZCnwB12nFD6kUjldRQiw,1303
|
|
187
192
|
funboost/publishers/mongomq_publisher.py,sha256=xQr3KMQEKksX4OEvzPlCl8v1VeBHaoZtYw2QujOUyGo,1874
|
|
188
193
|
funboost/publishers/mqtt_publisher.py,sha256=nL-pweqL8lkoRUliNKQtdXgryG0wZO7iIvjFdr1it1s,3131
|
|
194
|
+
funboost/publishers/mysql_cdc_publisher.py,sha256=CjFQ79zkbZnd60K3oNOMfrK9QPYeXpXg16CtmxL3Xao,828
|
|
189
195
|
funboost/publishers/nameko_publisher.py,sha256=aTcoYdEd6WWi2cbzMDYC6_GgFT31W9c6nIl-nX9YnJI,1682
|
|
190
196
|
funboost/publishers/nats_publisher.py,sha256=_hnYc9qev8T1ddRC2TcdShoLnqLgFK7SoxNOs740WPM,815
|
|
191
197
|
funboost/publishers/nsq_publisher.py,sha256=ySUUyfAMRPSozWYGzAgOMCR_MF0J1iZTDFVU1DzrY5A,1313
|
|
@@ -217,15 +223,13 @@ funboost/timing_job/__init__.py,sha256=_rIiU7pMXe-IwUCeok50hSiWXoUoMBar22u6-pZLl
|
|
|
217
223
|
funboost/timing_job/apscheduler_use_mysql_store.py,sha256=ss92DiSLzbWuVIo19sTLgC99GessltWLOlqqOd4AIL4,471
|
|
218
224
|
funboost/timing_job/apscheduler_use_redis_store.py,sha256=j4sCizlEwQtCgFoeMHNY19n95qA8y7hWuMCCLrMnsEo,4437
|
|
219
225
|
funboost/timing_job/timing_job_base.py,sha256=VqPUYOJw0IYDZcNyJdHQdsidw-D2aCZl2rR0QQrV-n8,10149
|
|
220
|
-
funboost/timing_job/timing_push.py,sha256=
|
|
226
|
+
funboost/timing_job/timing_push.py,sha256=4MvxIyZA9txbmTVU4HBZg2h3Gcepjl7vDKFQC9u3Glw,8139
|
|
221
227
|
funboost/utils/__init__.py,sha256=848aTly3va-j0Ob-a3KGIuWd29Jc_O-K_OXJalxgxJI,571
|
|
222
228
|
funboost/utils/apscheduler_monkey.py,sha256=CcUISbqX6nMWSxr_QjZ26IvvhUk_ojYZWRaKenpsKfE,3124
|
|
223
229
|
funboost/utils/block_exit.py,sha256=BnfxNYo3lnmhk686RAEoc4u3D4RU_iEMMMgu5L8gIuI,96
|
|
224
230
|
funboost/utils/bulk_operation.py,sha256=B4FBxlz5f4oqlKDWqer7axn4gnDSfsYoMW2zSUCnGcQ,10101
|
|
225
231
|
funboost/utils/class_utils.py,sha256=xtP9RU_5vVnWye7QXXqkloDzwVE5N3N-4_2fUZNfXlo,3591
|
|
226
|
-
funboost/utils/class_utils2.py,sha256=ND45cMR385xG4fOmwWDHxXFOmcEi1ZG8B0iN8_6ZAeo,3015
|
|
227
232
|
funboost/utils/ctrl_c_end.py,sha256=v5QZ0X5owPJBXp3zNBElj-RTkBLL2DuE85C7rQQJcJU,1220
|
|
228
|
-
funboost/utils/custom_pysnooper.py,sha256=7yXLKEMY_JjPRRt0Y0N-wV2CFhILlYNh40Y6uRBUaj8,5923
|
|
229
233
|
funboost/utils/decorators.py,sha256=gpwof-Nw__iFjeJjVQWx1l-scnxTivxcCI_0XqhMu6c,27885
|
|
230
234
|
funboost/utils/develop_log.py,sha256=Wsx0ongGjTit5xqgk1BztYlVEkC6d0-Y7GENXLedVqY,271
|
|
231
235
|
funboost/utils/expire_lock.py,sha256=AOkd1KlvZeIwQaz8ZoKxLpGxWgqQ4mfNHcFphh04o8Q,4732
|
|
@@ -322,16 +326,9 @@ funboost/utils/func_timeout/dafunc.py,sha256=Yy98BzsmgWi07ja5zM4ElLwb1h8NXahxtRG
|
|
|
322
326
|
funboost/utils/func_timeout/exceptions.py,sha256=tUEaspemq_dS460EQvUMMSxeeyjIbgfEHIdxIC6ZhaU,3974
|
|
323
327
|
funboost/utils/func_timeout/py2_raise.py,sha256=9tpZLQ3-zIgU_ixazydwZmw8rFg7ybjI9alNYfSvwRk,169
|
|
324
328
|
funboost/utils/func_timeout/py3_raise.py,sha256=Odvg1FtXTEC--Ru1EIfsHASamBpOm9hdXY7OnlEUObA,280
|
|
325
|
-
funboost/
|
|
326
|
-
funboost/
|
|
327
|
-
funboost/
|
|
328
|
-
funboost/
|
|
329
|
-
funboost/
|
|
330
|
-
funboost/
|
|
331
|
-
funboost/utils/times/version.py,sha256=11XfnZVVzOgIhXXdeN_mYfdXThfrsbQHpA0wCjz-hpg,17
|
|
332
|
-
funboost-49.8.dist-info/LICENSE,sha256=9EPP2ktG_lAPB8PjmWV-c9BiaJHc_FP6pPLcUrUwx0E,11562
|
|
333
|
-
funboost-49.8.dist-info/METADATA,sha256=Ivm-JKglnPONj5zwwpNfO0H6KIR8CMMhnCCQJJmbCKE,42599
|
|
334
|
-
funboost-49.8.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
|
335
|
-
funboost-49.8.dist-info/entry_points.txt,sha256=yMSSAGRzRAAhGyNNQHw24MooKlDZsaJ499_D6fPl58A,96
|
|
336
|
-
funboost-49.8.dist-info/top_level.txt,sha256=K8WuKnS6MRcEWxP1NvbmCeujJq6TEfbsB150YROlRw0,9
|
|
337
|
-
funboost-49.8.dist-info/RECORD,,
|
|
329
|
+
funboost-49.9.dist-info/LICENSE,sha256=9EPP2ktG_lAPB8PjmWV-c9BiaJHc_FP6pPLcUrUwx0E,11562
|
|
330
|
+
funboost-49.9.dist-info/METADATA,sha256=PSZqrYQtMP2nWhuX9Zmg6n-bZmDF6NySy_AVPYelnC4,45942
|
|
331
|
+
funboost-49.9.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
|
332
|
+
funboost-49.9.dist-info/entry_points.txt,sha256=yMSSAGRzRAAhGyNNQHw24MooKlDZsaJ499_D6fPl58A,96
|
|
333
|
+
funboost-49.9.dist-info/top_level.txt,sha256=K8WuKnS6MRcEWxP1NvbmCeujJq6TEfbsB150YROlRw0,9
|
|
334
|
+
funboost-49.9.dist-info/RECORD,,
|
funboost/utils/class_utils2.py
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import copy
|
|
2
|
-
import gc
|
|
3
|
-
import inspect
|
|
4
|
-
import re
|
|
5
|
-
import sys
|
|
6
|
-
import traceback
|
|
7
|
-
import typing
|
|
8
|
-
|
|
9
|
-
import nb_log
|
|
10
|
-
from types import MethodType, FunctionType
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
class ClsHelper:
|
|
16
|
-
@staticmethod
|
|
17
|
-
def is_static_method(func):
|
|
18
|
-
# 获取类名
|
|
19
|
-
class_name = func.__qualname__.split('.')[0]
|
|
20
|
-
# 使用 inspect 获取函数的原始定义
|
|
21
|
-
return isinstance(func, staticmethod) or (inspect.isfunction(func) and func.__qualname__.startswith(f'{class_name}.'))
|
|
22
|
-
|
|
23
|
-
# 判断函数是否是实例方法
|
|
24
|
-
@staticmethod
|
|
25
|
-
def is_instance_method(method):
|
|
26
|
-
# 检查方法是否是绑定到类实例上的方法
|
|
27
|
-
return inspect.ismethod(method) or (inspect.isfunction(method) and getattr(method, '__self__', None) is not None)
|
|
28
|
-
|
|
29
|
-
@staticmethod
|
|
30
|
-
def is_class_method(method):
|
|
31
|
-
# 检查方法是否是类方法
|
|
32
|
-
return isinstance(method, classmethod) or (inspect.isfunction(method) and method.__self__ is None)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
@classmethod
|
|
37
|
-
def is_common_function(cls, method):
|
|
38
|
-
if cls.is_static_method(method):
|
|
39
|
-
return False
|
|
40
|
-
if cls.is_class_method(method):
|
|
41
|
-
return False
|
|
42
|
-
if cls.is_instance_method(method):
|
|
43
|
-
return False
|
|
44
|
-
if isinstance(method, FunctionType):
|
|
45
|
-
sourcelines = inspect.getsourcelines(method)
|
|
46
|
-
for line in sourcelines[0][:50]:
|
|
47
|
-
if not line.replace(' ', '').startswith('#'):
|
|
48
|
-
if not re.search('\(\s*?self\s*?,', line):
|
|
49
|
-
return True
|
|
50
|
-
|
|
51
|
-
@classmethod
|
|
52
|
-
def get_method_kind(cls, method: typing.Callable) -> str:
|
|
53
|
-
func =method
|
|
54
|
-
try:
|
|
55
|
-
if cls.is_instance_method(func):
|
|
56
|
-
return "实例方法"
|
|
57
|
-
if cls.is_static_method(func):
|
|
58
|
-
return "静态方法"
|
|
59
|
-
if cls.is_class_method(func):
|
|
60
|
-
return "类方法"
|
|
61
|
-
if inspect.isfunction(func):
|
|
62
|
-
return "模块级函数"
|
|
63
|
-
except Exception as e:
|
|
64
|
-
print(traceback.format_exc())
|
|
65
|
-
|
|
66
|
-
@staticmethod
|
|
67
|
-
def get_obj_init_params_for_funboost(obj_init_params: dict):
|
|
68
|
-
obj_init_params.pop('self')
|
|
69
|
-
return copy.deepcopy(obj_init_params)
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
if __name__ == '__main__':
|
|
75
|
-
def module_function():
|
|
76
|
-
return "I am a module-level function"
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
class MyClass:
|
|
80
|
-
@staticmethod
|
|
81
|
-
def static_method():
|
|
82
|
-
return "I am a static method"
|
|
83
|
-
|
|
84
|
-
@classmethod
|
|
85
|
-
def class_method(cls):
|
|
86
|
-
return "I am a class method"
|
|
87
|
-
|
|
88
|
-
def instance_method(self):
|
|
89
|
-
return "I am a instance method"
|
|
90
|
-
|
|
91
|
-
print(ClsHelper.get_method_kind(module_function)) # 输出: 模块级函数
|
|
92
|
-
print(ClsHelper.get_method_kind(MyClass.static_method)) # 输出: 静态方法
|
|
93
|
-
print(ClsHelper.get_method_kind(MyClass.class_method)) # 输出: 类方法
|
|
94
|
-
print(ClsHelper.get_method_kind(MyClass.instance_method)) # 输出: 实例方法
|