funboost 42.8__py3-none-any.whl → 42.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 CHANGED
@@ -13,7 +13,7 @@ set_frame_config这个模块的 use_config_form_funboost_config_module() 是核
13
13
  这段注释说明和使用的用户无关,只和框架开发人员有关.
14
14
  '''
15
15
 
16
- __version__ = "42.8"
16
+ __version__ = "42.9"
17
17
 
18
18
  from funboost.set_frame_config import show_frame_config
19
19
 
@@ -57,6 +57,9 @@ from funboost.utils.ctrl_c_end import ctrl_c_recv
57
57
  from funboost.utils.redis_manager import RedisMixin
58
58
  from funboost.concurrent_pool.custom_threadpool_executor import show_current_threads_num
59
59
 
60
+ from funboost.core.current_task import funboost_current_task
61
+
62
+
60
63
  # atexit.register(ctrl_c_recv) # 还是需要用户自己在代码末尾加才可以.
61
64
  # set_interrupt_signal_handler()
62
65
 
@@ -5,6 +5,50 @@ from funboost.core.function_result_status_saver import FunctionResultStatus
5
5
 
6
6
 
7
7
  class ThreadCurrentTask:
8
+ """
9
+ 用于在用户自己函数内部去获取 消息的完整体,当前重试次数等.
10
+ """
11
+ """ 用法例子
12
+ '''
13
+ fct = funboost_current_task()
14
+ print(fct.function_result_status.get_status_dict())
15
+ print(fct.function_result_status.task_id)
16
+ print(fct.function_result_status.run_times)
17
+ print(fct.full_msg)
18
+ '''
19
+ import random
20
+ import time
21
+
22
+ from funboost import boost, FunctionResultStatusPersistanceConfig,BoosterParams
23
+ from funboost.core.current_task import funboost_current_task
24
+
25
+ @boost(BoosterParams(queue_name='queue_test_f01', qps=2,concurrent_num=5,
26
+ function_result_status_persistance_conf=FunctionResultStatusPersistanceConfig(
27
+ is_save_status=True, is_save_result=True, expire_seconds=7 * 24 * 3600)))
28
+ def f(a, b):
29
+ fct = funboost_current_task()
30
+ print(fct.function_result_status.get_status_dict())
31
+ print(fct.function_result_status.task_id)
32
+ print(fct.function_result_status.run_times)
33
+ print(fct.full_msg)
34
+
35
+ time.sleep(20)
36
+ if random.random() > 0.5:
37
+ raise Exception(f'{a} {b} 模拟出错啦')
38
+ print(a+b)
39
+
40
+ return a + b
41
+
42
+
43
+ if __name__ == '__main__':
44
+ # f(5, 6) # 可以直接调用
45
+
46
+ for i in range(0, 200):
47
+ f.push(i, b=i * 2)
48
+
49
+ f.consume()
50
+
51
+ """
8
52
  _local_data = threading.local()
9
53
 
10
54
  @property
@@ -34,9 +78,9 @@ class ThreadCurrentTask:
34
78
 
35
79
  def is_asyncio_environment():
36
80
  try:
37
- loop = asyncio.get_event_loop()
81
+ loop = asyncio.get_running_loop()
38
82
  return True
39
- except RuntimeError:
83
+ except RuntimeError as e:
40
84
  return False
41
85
 
42
86
 
@@ -72,3 +116,11 @@ class AsyncioCurrentTask:
72
116
 
73
117
  def funboost_current_task():
74
118
  return AsyncioCurrentTask() if is_asyncio_environment() else ThreadCurrentTask()
119
+
120
+
121
+ if __name__ == '__main__':
122
+ print(is_asyncio_environment())
123
+ print()
124
+ for i in range(100000):
125
+ funboost_current_task()
126
+ print()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: funboost
3
- Version: 42.8
3
+ Version: 42.9
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=kzbzI9GMGWAIPBZhBh1PQltFVbL3Y9FU1rWLD3rzw7Q,3766
1
+ funboost/__init__.py,sha256=XzfCfRudODC_6yXZwNCJB6jCk41f9E7odZe2b2RoxvY,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=haAbx2cvTN9itPzBG4v3_ODIi1-RudvBj6s_QjniqjU,7162
@@ -82,7 +82,7 @@ funboost/contrib/save_result_status_to_sqldb.py,sha256=AxvD7nHs4sjr9U0kwEZzyPKrs
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
84
  funboost/core/booster.py,sha256=k6UPxfW7QdhfdVu9yprHkF46jLO2eXTqTZPYkukmyZc,15741
85
- funboost/core/current_task.py,sha256=SNwDpT44kLZP_1utX3XeAfc_3-yturaIlst-F-RtDu0,2223
85
+ funboost/core/current_task.py,sha256=DNBNJtnFSy8NtEvUoAHVjPgf2pXV7L95fkKdixaqfeE,3699
86
86
  funboost/core/exceptions.py,sha256=pLF7BkRJAfDiWp2_xGZqencmwdPiSQI1NENbImExknY,1311
87
87
  funboost/core/fabric_deploy_helper.py,sha256=KPjifNy1G1tDOT2eaR0X8hegot0HUk5vF-P1DnhxME4,8941
88
88
  funboost/core/func_params_model.py,sha256=jVPWke_UpwZ_Ik28_dL_j8h2dSrtYlEFTtUWMIw2KCA,17594
@@ -262,9 +262,9 @@ funboost/utils/pysnooper_ydf/utils.py,sha256=evSmGi_Oul7vSP47AJ0DLjFwoCYCfunJZ1m
262
262
  funboost/utils/pysnooper_ydf/variables.py,sha256=QejRDESBA06KG9OH4sBT4J1M55eaU29EIHg8K_igaXo,3693
263
263
  funboost/utils/times/__init__.py,sha256=Y4bQD3SIA_E7W2YvHq2Qdi0dGM4H2DxyFNdDOuFOq1w,2417
264
264
  funboost/utils/times/version.py,sha256=11XfnZVVzOgIhXXdeN_mYfdXThfrsbQHpA0wCjz-hpg,17
265
- funboost-42.8.dist-info/LICENSE,sha256=9EPP2ktG_lAPB8PjmWV-c9BiaJHc_FP6pPLcUrUwx0E,11562
266
- funboost-42.8.dist-info/METADATA,sha256=fKQQyuhqf4LgD3Wz7S9KpouaILjDpmB4PBr9wvaEiUM,30477
267
- funboost-42.8.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
268
- funboost-42.8.dist-info/entry_points.txt,sha256=yMSSAGRzRAAhGyNNQHw24MooKlDZsaJ499_D6fPl58A,96
269
- funboost-42.8.dist-info/top_level.txt,sha256=K8WuKnS6MRcEWxP1NvbmCeujJq6TEfbsB150YROlRw0,9
270
- funboost-42.8.dist-info/RECORD,,
265
+ funboost-42.9.dist-info/LICENSE,sha256=9EPP2ktG_lAPB8PjmWV-c9BiaJHc_FP6pPLcUrUwx0E,11562
266
+ funboost-42.9.dist-info/METADATA,sha256=pKonNSFLcVH_ITNycv0MYSg_rdIodpXfuVODRZYxoV0,30477
267
+ funboost-42.9.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
268
+ funboost-42.9.dist-info/entry_points.txt,sha256=yMSSAGRzRAAhGyNNQHw24MooKlDZsaJ499_D6fPl58A,96
269
+ funboost-42.9.dist-info/top_level.txt,sha256=K8WuKnS6MRcEWxP1NvbmCeujJq6TEfbsB150YROlRw0,9
270
+ funboost-42.9.dist-info/RECORD,,