funboost 47.8__py3-none-any.whl → 47.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/core/func_params_model.py +1 -0
- funboost/timing_job/__init__.py +1 -1
- funboost/utils/class_utils2.py +94 -0
- {funboost-47.8.dist-info → funboost-47.9.dist-info}/METADATA +1 -1
- {funboost-47.8.dist-info → funboost-47.9.dist-info}/RECORD +10 -9
- {funboost-47.8.dist-info → funboost-47.9.dist-info}/LICENSE +0 -0
- {funboost-47.8.dist-info → funboost-47.9.dist-info}/WHEEL +0 -0
- {funboost-47.8.dist-info → funboost-47.9.dist-info}/entry_points.txt +0 -0
- {funboost-47.8.dist-info → funboost-47.9.dist-info}/top_level.txt +0 -0
funboost/__init__.py
CHANGED
|
@@ -154,6 +154,7 @@ class BoosterParams(BaseJsonAbleModel):
|
|
|
154
154
|
retry_interval: typing.Union[float, int] = 0 # 函数出错后间隔多少秒再重试.
|
|
155
155
|
is_push_to_dlx_queue_when_retry_max_times: bool = False # 函数达到最大重试次数仍然没成功,是否发送到死信队列,死信队列的名字是 队列名字 + _dlx。
|
|
156
156
|
|
|
157
|
+
|
|
157
158
|
consumin_function_decorator: typing.Callable = None # 函数的装饰器。因为此框架做参数自动转指点,需要获取精准的入参名称,不支持在消费函数上叠加 @ *args **kwargs的装饰器,如果想用装饰器可以这里指定。
|
|
158
159
|
function_timeout: typing.Union[int, float,None] = None # 超时秒数,函数运行超过这个时间,则自动杀死函数。为0是不限制。 谨慎使用,非必要别去设置超时时间,设置后性能会降低(因为需要把用户函数包装到另一个线单独的程中去运行),而且突然强制超时杀死运行中函数,可能会造成死锁.(例如用户函数在获得线程锁后突然杀死函数,别的线程再也无法获得锁了)
|
|
159
160
|
|
funboost/timing_job/__init__.py
CHANGED
|
@@ -167,7 +167,7 @@ class FunboostBackgroundScheduler(BackgroundScheduler):
|
|
|
167
167
|
"""
|
|
168
168
|
MAX_WAIT_SECONDS_FOR_NEX_PROCESS_JOBS = 0.5
|
|
169
169
|
wait_seconds = None
|
|
170
|
-
while self.state
|
|
170
|
+
while self.state != STATE_STOPPED:
|
|
171
171
|
if wait_seconds is None:
|
|
172
172
|
wait_seconds = MAX_WAIT_SECONDS_FOR_NEX_PROCESS_JOBS
|
|
173
173
|
self._last_wait_seconds = min(wait_seconds, MAX_WAIT_SECONDS_FOR_NEX_PROCESS_JOBS)
|
|
@@ -0,0 +1,94 @@
|
|
|
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)) # 输出: 实例方法
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: funboost
|
|
3
|
-
Version: 47.
|
|
3
|
+
Version: 47.9
|
|
4
4
|
Summary: pip install funboost,python全功能分布式函数调度框架,funboost的功能是全面性重量级,用户能想得到的功能99%全都有;funboost的使用方式是轻量级,只有@boost一行代码需要写。支持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=
|
|
1
|
+
funboost/__init__.py,sha256=l8lcf1PvoDA8EMs003cPTt7X2oqjga7S2rK9SkdQoqw,3956
|
|
2
2
|
funboost/__init__old.py,sha256=9Kv3cPLnPkbzMRnuJFVkPsuDdx1CdcSIuITkpdncZSc,20382
|
|
3
3
|
funboost/__main__.py,sha256=-6Nogi666Y0LN8fVm3JmHGTOk8xEGWvotW_GDbSaZME,1065
|
|
4
4
|
funboost/constant.py,sha256=STzRDZbuCC5FFV-uD_0r2beGsD1Zni4kregzR11z3Ok,8148
|
|
@@ -92,7 +92,7 @@ funboost/core/exceptions.py,sha256=pLF7BkRJAfDiWp2_xGZqencmwdPiSQI1NENbImExknY,1
|
|
|
92
92
|
funboost/core/fabric_deploy_helper.py,sha256=foieeqlNySuU9axJzNF6TavPjIUSYBx9UO3syVKUiyY,9999
|
|
93
93
|
funboost/core/funboost_config_getter.py,sha256=b5nAdAmUxahskY-ohB7ptf2gKywFlDA0Fq1cWroxxbs,384
|
|
94
94
|
funboost/core/funboost_time.py,sha256=a0MacbUBfYk8mf7D3UUyCxH5QJsu8YiGVXwJqPnSQH0,1779
|
|
95
|
-
funboost/core/func_params_model.py,sha256=
|
|
95
|
+
funboost/core/func_params_model.py,sha256=ZKpkQrIJhPwOBubcjbluVr06U1h48B6qK6CfdQ6R29Y,22512
|
|
96
96
|
funboost/core/function_result_status_config.py,sha256=PyjqAQOiwsLt28sRtH-eYRjiI3edPFO4Nde0ILFRReE,1764
|
|
97
97
|
funboost/core/function_result_status_saver.py,sha256=yHKZF9MjmhI-Q4Mkrka7DdweJ0wpgfLmgfAlsfkCeCk,9274
|
|
98
98
|
funboost/core/helper_funs.py,sha256=SsMa7A3iJyLek6v1qRK02kINebDp6kuAmlYkrYLXwQ0,2369
|
|
@@ -172,7 +172,7 @@ funboost/queues/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
172
172
|
funboost/queues/memory_queues_map.py,sha256=e1S_cnjnCVI4DBsA_iupF51S_eX4OvCtlefQCqS1TYA,424
|
|
173
173
|
funboost/queues/peewee_queue.py,sha256=FrwegrilkHZG6Y1cGdl5Bt_UtA25f7m5TJQJMZ9YnJI,5280
|
|
174
174
|
funboost/queues/sqla_queue.py,sha256=b-2QPvvuMxklm41ibZhGKehaAV9trXBQFCOHzgThx_s,11080
|
|
175
|
-
funboost/timing_job/__init__.py,sha256=
|
|
175
|
+
funboost/timing_job/__init__.py,sha256=XYKZwis7DBY03iTzt36QPEuU_jjiAOvEsHDvsfv9lrk,10362
|
|
176
176
|
funboost/timing_job/apscheduler_use_mysql_store.py,sha256=ss92DiSLzbWuVIo19sTLgC99GessltWLOlqqOd4AIL4,471
|
|
177
177
|
funboost/timing_job/apscheduler_use_redis_store.py,sha256=RNZVerUTTzpSFMFEHWkDrUOSz71B4Ml_hlcavkL1tAA,2933
|
|
178
178
|
funboost/utils/__init__.py,sha256=rAyXE7lgCo_3VdMvGrIJiqsTHv2nZPTJDTj1f6s_KgE,586
|
|
@@ -180,6 +180,7 @@ funboost/utils/apscheduler_monkey.py,sha256=CcUISbqX6nMWSxr_QjZ26IvvhUk_ojYZWRaK
|
|
|
180
180
|
funboost/utils/block_exit.py,sha256=BnfxNYo3lnmhk686RAEoc4u3D4RU_iEMMMgu5L8gIuI,96
|
|
181
181
|
funboost/utils/bulk_operation.py,sha256=B4FBxlz5f4oqlKDWqer7axn4gnDSfsYoMW2zSUCnGcQ,10101
|
|
182
182
|
funboost/utils/class_utils.py,sha256=xtP9RU_5vVnWye7QXXqkloDzwVE5N3N-4_2fUZNfXlo,3591
|
|
183
|
+
funboost/utils/class_utils2.py,sha256=ND45cMR385xG4fOmwWDHxXFOmcEi1ZG8B0iN8_6ZAeo,3015
|
|
183
184
|
funboost/utils/ctrl_c_end.py,sha256=FgT9An-qsUA5gW-V-UKWqOh5shC7C_uvTFn0fS7i8GI,439
|
|
184
185
|
funboost/utils/custom_pysnooper.py,sha256=7yXLKEMY_JjPRRt0Y0N-wV2CFhILlYNh40Y6uRBUaj8,5923
|
|
185
186
|
funboost/utils/decorators.py,sha256=gpwof-Nw__iFjeJjVQWx1l-scnxTivxcCI_0XqhMu6c,27885
|
|
@@ -283,9 +284,9 @@ funboost/utils/pysnooper_ydf/utils.py,sha256=evSmGi_Oul7vSP47AJ0DLjFwoCYCfunJZ1m
|
|
|
283
284
|
funboost/utils/pysnooper_ydf/variables.py,sha256=QejRDESBA06KG9OH4sBT4J1M55eaU29EIHg8K_igaXo,3693
|
|
284
285
|
funboost/utils/times/__init__.py,sha256=Y4bQD3SIA_E7W2YvHq2Qdi0dGM4H2DxyFNdDOuFOq1w,2417
|
|
285
286
|
funboost/utils/times/version.py,sha256=11XfnZVVzOgIhXXdeN_mYfdXThfrsbQHpA0wCjz-hpg,17
|
|
286
|
-
funboost-47.
|
|
287
|
-
funboost-47.
|
|
288
|
-
funboost-47.
|
|
289
|
-
funboost-47.
|
|
290
|
-
funboost-47.
|
|
291
|
-
funboost-47.
|
|
287
|
+
funboost-47.9.dist-info/LICENSE,sha256=9EPP2ktG_lAPB8PjmWV-c9BiaJHc_FP6pPLcUrUwx0E,11562
|
|
288
|
+
funboost-47.9.dist-info/METADATA,sha256=C3yeGEucRB3T10Ju_3LlPeUetNhcskJUq5EjLmDJN8w,33382
|
|
289
|
+
funboost-47.9.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
|
290
|
+
funboost-47.9.dist-info/entry_points.txt,sha256=yMSSAGRzRAAhGyNNQHw24MooKlDZsaJ499_D6fPl58A,96
|
|
291
|
+
funboost-47.9.dist-info/top_level.txt,sha256=K8WuKnS6MRcEWxP1NvbmCeujJq6TEfbsB150YROlRw0,9
|
|
292
|
+
funboost-47.9.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|