funboost 48.6__py3-none-any.whl → 48.8__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 (41) hide show
  1. funboost/__init__.py +2 -2
  2. funboost/__main__.py +2 -0
  3. funboost/concurrent_pool/async_pool_executor.py +1 -0
  4. funboost/concurrent_pool/flexible_thread_pool.py +1 -0
  5. funboost/constant.py +2 -1
  6. funboost/consumers/base_consumer.py +4 -3
  7. funboost/consumers/rabbitmq_amqpstorm_consumer.py +1 -1
  8. funboost/core/active_cousumer_info_getter.py +3 -3
  9. funboost/core/booster.py +1 -1
  10. funboost/core/cli/funboost_fire.py +10 -0
  11. funboost/core/msg_result_getter.py +1 -0
  12. funboost/function_result_web/__pycache__/app.cpython-37.pyc +0 -0
  13. funboost/function_result_web/__pycache__/app.cpython-39.pyc +0 -0
  14. funboost/function_result_web/__pycache__/functions.cpython-37.pyc +0 -0
  15. funboost/function_result_web/__pycache__/functions.cpython-39.pyc +0 -0
  16. funboost/function_result_web/app.py +42 -2
  17. funboost/function_result_web/app_debug_start.py +6 -0
  18. funboost/function_result_web/functions.py +57 -3
  19. funboost/function_result_web/static/js_cdn/tabulator-tables@5.5.0/dist/js/tabulator.min.js +1 -1
  20. funboost/function_result_web/templates/about.html +0 -9
  21. funboost/function_result_web/templates/conusme_speed.html +2 -2
  22. funboost/function_result_web/templates/fun_result_table.html +1 -1
  23. funboost/function_result_web/templates/index.html +34 -9
  24. funboost/function_result_web/templates/queue_op.html +1 -1
  25. funboost/function_result_web/templates/rpc_call.html +298 -0
  26. funboost/function_result_web/templates/running_consumer_by_ip.html +2 -2
  27. funboost/function_result_web/templates/running_consumer_by_queue_name.html +2 -2
  28. funboost/timing_job/apscheduler_use_redis_store.py +1 -1
  29. funboost/timing_job/timing_job_base.py +2 -0
  30. funboost/timing_job/timing_push.py +10 -4
  31. funboost/utils/ctrl_c_end.py +19 -1
  32. funboost/utils/dependency_packages_in_pythonpath/__pycache__/__init__.cpython-313.pyc +0 -0
  33. funboost/utils/dependency_packages_in_pythonpath/__pycache__/add_to_pythonpath.cpython-313.pyc +0 -0
  34. funboost/utils/dependency_packages_in_pythonpath/aioredis/readme.md +6 -0
  35. funboost/utils/dependency_packages_in_pythonpath/readme.md +6 -0
  36. {funboost-48.6.dist-info → funboost-48.8.dist-info}/METADATA +7 -3
  37. {funboost-48.6.dist-info → funboost-48.8.dist-info}/RECORD +41 -37
  38. {funboost-48.6.dist-info → funboost-48.8.dist-info}/LICENSE +0 -0
  39. {funboost-48.6.dist-info → funboost-48.8.dist-info}/WHEEL +0 -0
  40. {funboost-48.6.dist-info → funboost-48.8.dist-info}/entry_points.txt +0 -0
  41. {funboost-48.6.dist-info → funboost-48.8.dist-info}/top_level.txt +0 -0
@@ -33,15 +33,6 @@
33
33
  </head>
34
34
  <body>
35
35
  <div class="container">
36
- <nav class="navbar navbar-default navbar-fixed-top" style="min-height: 40px;">
37
- <div class="container-fluid">
38
- <div class="navbar-header pull-right">
39
- <a href="{{url_for('logout')}}" class="btn btn-danger" style="margin: 4px 15px;">
40
- <i class="fa fa-sign-out"></i> 退出
41
- </a>
42
- </div>
43
- </div>
44
- </nav>
45
36
  <h1>funboost web manager 说明</h1>
46
37
  <div class="info-block">
47
38
  <h4>1. 函数结果 和 消费速率</h4>
@@ -102,7 +102,7 @@
102
102
  var html = '<option value="">请选择队列...</option>';
103
103
  for (var item of result) {
104
104
  html += '<option value="' + item.collection_name + '">' +
105
- item.collection_name + ' (' + item.count + ')</option>';
105
+ item.collection_name + '&nbsp;&nbsp;&nbsp;&nbsp;(result_count:' + item.count + ')</option>';
106
106
  }
107
107
  $("#col_name_search").html(html);
108
108
 
@@ -110,7 +110,7 @@
110
110
  $("#col_name_search").select2({
111
111
  placeholder: "请输入队列名称搜索...",
112
112
  allowClear: true,
113
- width: '300px'
113
+ width: '500px'
114
114
  });
115
115
 
116
116
  // 监听选择变化
@@ -172,7 +172,7 @@
172
172
  var html = '<option value="">请选择队列...</option>';
173
173
  for (var item of result) {
174
174
  html += '<option value="' + item.collection_name + '">' +
175
- item.collection_name + ' (' + item.count + ')</option>';
175
+ item.collection_name + '&nbsp;&nbsp;&nbsp;&nbsp;(result_count:' + item.count + ')</option>';
176
176
  }
177
177
  $("#col_name_search").html(html);
178
178
 
@@ -133,35 +133,45 @@
133
133
  <div class="sidebar">
134
134
  <ul class="nav flex-column">
135
135
  <li class="nav-item">
136
- <a class="nav-link " href="#" data-target="/tpl/fun_result_table.html">
136
+ <a class="nav-link " href="/?page=fun_result_table" data-target="/tpl/fun_result_table.html">
137
137
  <i class="fa fa-table"></i><span>函数结果表</span>
138
138
  </a>
139
139
  </li>
140
140
  <li class="nav-item">
141
- <a class="nav-link" href="#" data-target="/tpl/conusme_speed.html">
141
+ <a class="nav-link" href="/?page=conusme_speed" data-target="/tpl/conusme_speed.html">
142
142
  <i class="fa fa-tachometer"></i><span>消费速率图</span>
143
143
  </a>
144
144
  </li>
145
145
  <li class="nav-item">
146
- <a class="nav-link" href="#" data-target="/tpl/running_consumer_by_ip.html">
146
+ <a class="nav-link" href="/?page=running_consumer_by_ip" data-target="/tpl/running_consumer_by_ip.html">
147
147
  <i class="fa fa-server"></i><span>运行中消费者(by ip)</span>
148
148
  </a>
149
149
  </li>
150
150
  <li class="nav-item">
151
- <a class="nav-link" href="#" data-target="/tpl/running_consumer_by_queue_name.html">
151
+ <a class="nav-link" href="/?page=running_consumer_by_queue_name" data-target="/tpl/running_consumer_by_queue_name.html">
152
152
  <i class="fa fa-list"></i><span>运行中消费者(by queue)</span>
153
153
  </a>
154
154
  </li>
155
155
  <li class="nav-item ">
156
- <a class="nav-link active" href="#" data-target="/tpl/queue_op.html">
156
+ <a class="nav-link active" href="/?page=queue_op" data-target="/tpl/queue_op.html">
157
157
  <i class="fa fa-cogs"></i><span>队列操作</span>
158
158
  </a>
159
159
  </li>
160
160
  <li class="nav-item">
161
- <a class="nav-link" href="#" data-target="/tpl/about.html">
161
+ <a class="nav-link" href="/?page=rpc_call" data-target="/tpl/rpc_call.html">
162
+ <i class="fa fa-cogs"></i><span>rpc调用</span>
163
+ </a>
164
+ </li>
165
+ <li class="nav-item">
166
+ <a class="nav-link" href="/?page=about" data-target="/tpl/about.html">
162
167
  <i class="fa fa-info-circle"></i><span>说明</span>
163
168
  </a>
164
169
  </li>
170
+ <li class="nav-item">
171
+ <a class="nav-link" href="/logout">
172
+ <i class="fa fa-sign-out"></i><span>退出登录</span>
173
+ </a>
174
+ </li>
165
175
  </ul>
166
176
  </div>
167
177
 
@@ -197,12 +207,27 @@
197
207
  });
198
208
 
199
209
  $(document).ready(function () {
200
- // 初始加载 Home 页面
201
- loadPage('/tpl/queue_op.html');
210
+ // 检查URL参数是否指定了页面
211
+ var urlParams = new URLSearchParams(window.location.search);
212
+ var pageName = urlParams.get('page');
213
+
214
+ // 初始加载页面
215
+ if (pageName) {
216
+ // 根据URL参数加载页面
217
+ loadPage('/tpl/' + pageName + '.html');
218
+ // 设置对应导航为active
219
+ $('.sidebar .nav-link').removeClass('active');
220
+ $('.sidebar .nav-link[href="/?page=' + pageName + '"]').addClass('active');
221
+ } else {
222
+ // 默认加载队列操作页面
223
+ loadPage('/tpl/queue_op.html');
224
+ }
202
225
 
203
226
  // 导航栏点击事件
204
227
  $('.sidebar .nav-link').click(function (e) {
205
- e.preventDefault();
228
+ // 不阻止默认行为,允许页面跳转
229
+ // e.preventDefault();
230
+
206
231
  // 移除所有导航项的 active 类
207
232
  $('.sidebar .nav-link').removeClass('active');
208
233
  // 为当前点击的导航项添加 active 类
@@ -32,7 +32,7 @@
32
32
  margin-bottom: 15px;
33
33
  }
34
34
  #searchInput {
35
- width: 300px;
35
+ width: 500px;
36
36
  display: inline-block;
37
37
  }
38
38
  </style>
@@ -0,0 +1,298 @@
1
+ <!DOCTYPE html>
2
+ <html lang="zh">
3
+
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
7
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
8
+ <title>pytho万能分布式函数调度框架</title>
9
+ <link href="{{ url_for('static',filename='css_cdn/twitter-bootstrap/3.3.7/css/bootstrap.min.css') }}" rel="stylesheet">
10
+ <link href="{{ url_for('static',filename='css_cdn/font-awesome/4.7.0/css/font-awesome.min.css') }}" rel="stylesheet">
11
+ <link rel="stylesheet"
12
+ href="{{ url_for('static',filename='css_cdn/bootstrap-datetimepicker/4.17.47/css/bootstrap-datetimepicker.min.css') }}">
13
+ <link rel="stylesheet" href="{{ url_for('static',filename='assets/css/jquery.mCustomScrollbar.min.css') }}">
14
+ <link rel="stylesheet" href="{{ url_for('static',filename='assets/css/custom.css') }}">
15
+
16
+ <!-- 在其他 link 标签后添加 -->
17
+ <link href="{{ url_for('static',filename='css_cdn/select2/4.0.13/css/select2.min.css') }}" rel="stylesheet">
18
+ <link href="{{ url_for('static',filename='css/content_page_style.css') }}" rel="stylesheet">
19
+
20
+
21
+ <script src="{{ url_for('static',filename='js/jquery-1.11.0.min.js') }}" type="text/javascript"></script>
22
+ <!-- <script src="https://cdn.bootcdn.net/ajax/libs/jquery/1.11.0/jquery.min.js"></script> -->
23
+ <!-- 在其他 script 标签后添加 -->
24
+ <!-- <script src="https://cdn.bootcdn.net/ajax/libs/select2/4.0.13/js/select2.min.js"></script> -->
25
+ <script src="{{ url_for('static',filename='/js/select2.min.js') }}"></script>
26
+ <script src="{{ url_for('static',filename='js_cdn/bootstrap/3.3.7/js/bootstrap.min.js') }}"></script>
27
+
28
+
29
+ <script src="{{ url_for('static',filename='js/moment-with-locales.min.js') }}"></script>
30
+ <script src="{{ url_for('static',filename='js/bootstrap-datetimepicker.min.js') }}"></script>
31
+ <!-- <script src="https://cdn.bootcss.com/bootstrap-datetimepicker/4.17.47/js/bootstrap-datetimepicker.min.js"></script> -->
32
+ <!-- <script type="text/javascript" src="https://cdn.bootcss.com/echarts/3.3.0/echarts.js"></script> -->
33
+ <script type="text/javascript" src="{{ url_for('static',filename='js/echarts.min.js') }}"></script>
34
+
35
+ <script src="{{ url_for('static',filename='assets/js/jquery.mCustomScrollbar.concat.min.js') }}"></script>
36
+ <script src="{{ url_for('static',filename='assets/js/custom.js') }}"></script>
37
+
38
+
39
+ <!-- 添加 Tabulator 样式和脚本 -->
40
+ <link href="{{ url_for('static',filename='css_cdn/tabulator-tables@5.5.0/tabulator.min.css') }}" rel="stylesheet">
41
+ <link href="{{ url_for('static',filename='css_cdn/tabulator-tables@5.5.0/tabulator_bootstrap3.min.css') }}" rel="stylesheet">
42
+ <script type="text/javascript" src="{{ url_for('static',filename='js_cdn/tabulator-tables@5.5.0/dist/js/tabulator.min.js') }}"></script>
43
+
44
+ <style>
45
+
46
+ </style>
47
+ </head>
48
+
49
+ <body>
50
+
51
+ <div class="container-fluid" style="margin-top: 5px;">
52
+ <!-- 添加发布消息和RPC结果区域 -->
53
+ <div class="row" style="margin-top: 20px;">
54
+ <div class="col-md-6">
55
+ <h1 style="margin-bottom: 20px;color: red;">发送rpc请求:</h1>
56
+ <div class="form-group">
57
+ <div style="display: flex; align-items: center; margin-bottom: 10px;">
58
+
59
+ <label for="col_name_search" style="margin-right: 5px; white-space: nowrap;">队列名字:</label>
60
+ <select class="form-control" id="col_name_search" style="width: 500px;">
61
+ <option value="">请选择队列名字...</option>
62
+ </select>
63
+ </div>
64
+ <textarea class="form-control" id="message_content" rows="15" placeholder="请输入消息体JSON格式,如:{&quot;x&quot;:1,&quot;y&quot;:2}"></textarea>
65
+ </div>
66
+ <div class="form-inline" style="margin-bottom: 15px;">
67
+ <div class="checkbox" style="margin-right: 20px;">
68
+ <label>
69
+ <input type="checkbox" id="need_result" checked> 需要返回结果
70
+ </label>
71
+ </div>
72
+ <div class="form-group" style="margin-right: 20px;">
73
+ <label for="timeout" style="margin-right: 5px;">超时时间(秒):</label>
74
+ <input type="number" class="form-control" id="timeout" value="60" style="width: 80px;">
75
+ </div>
76
+ <button type="button" class="btn btn-primary" id="send_btn">发送RPC请求</button>
77
+ </div>
78
+ <div class="alert alert-info" id="status_display" style="margin-top: 10px;">
79
+ 准备发送RPC请求,请选择队列名称并输入消息内容
80
+ </div>
81
+
82
+ <h1 style="margin-bottom: 20px;margin-top: 70px;color: red;">获取task_id结果:</h1>
83
+ <div class="form-group">
84
+ <div style="display: flex; align-items: center;">
85
+ <label for="task_id" style="margin-right: 5px; white-space: nowrap;">task_id:</label>
86
+ <input type="text" class="form-control" id="task_id" style="width: 500px; margin-right: 15px;">
87
+ </div>
88
+ </div>
89
+ <div style="display: flex; align-items: center; margin-bottom: 15px;">
90
+ <div style="margin-right: 20px; display: flex; align-items: center;">
91
+ <label for="task_timeout" style="margin-right: 5px; white-space: nowrap;">超时时间(秒):</label>
92
+ <input type="number" class="form-control" id="task_timeout" value="30" style="width: 80px;">
93
+ </div>
94
+ <button type="button" class="btn btn-primary" id="get_result_btn">获取结果</button>
95
+ </div>
96
+ <div class="alert alert-info" id="task_status_display" style="margin-top: 10px;">
97
+ 准备获取结果,请输入task_id
98
+ </div>
99
+
100
+
101
+ </div>
102
+
103
+
104
+ <div class="col-md-6">
105
+ <div class="form-group">
106
+ <label for="rpc_result">RPC结果:</label>
107
+ <textarea class="form-control" id="rpc_result" rows="40" readonly></textarea>
108
+ </div>
109
+ </div>
110
+ </div>
111
+
112
+
113
+ <div id="result-table" style="margin-top: 20px;"></div>
114
+ </div>
115
+
116
+
117
+
118
+
119
+
120
+
121
+
122
+
123
+ <script>
124
+
125
+ // 在现有的变量声明后添加
126
+ var allQueues = []; // 存储所有队列数据
127
+ var currentColName;
128
+
129
+ // 页面加载完成后立即获取所有队列
130
+ $(document).ready(function () {
131
+ $.ajax({
132
+ url: "{{ url_for('get_msg_num')}}",
133
+ data: {},
134
+ async: true,
135
+ success: function (result) {
136
+ var html = '<option value="">请选择队列名字...</option>';
137
+ for (var queueName in result) {
138
+ var msgCount = result[queueName];
139
+ html += '<option value="' + queueName + '">' +
140
+ queueName + '&nbsp;&nbsp;&nbsp;&nbsp;(msg_count:' + msgCount + ')</option>';
141
+ }
142
+ $("#col_name_search").html(html);
143
+
144
+ // 初始化选择框的搜索功能
145
+ $("#col_name_search").select2({
146
+ placeholder: "请输入队列名称搜索...",
147
+ allowClear: true,
148
+ width: '500px',
149
+ minimumResultsForSearch: 0
150
+ });
151
+
152
+ // 监听选择变化
153
+ $("#col_name_search").on('change', function () {
154
+ var selectedQueue = $(this).val();
155
+ console.log("Selected queue:", selectedQueue);
156
+ currentColName = selectedQueue;
157
+ // if(selectedQueue) {
158
+ // queryResult(selectedQueue, 0, true);
159
+ // }
160
+ });
161
+ }
162
+ });
163
+ });
164
+
165
+ // 添加发送RPC请求的功能
166
+ $(document).ready(function() {
167
+ // 已有的队列加载代码...
168
+
169
+ // 发送RPC请求按钮点击事件
170
+ $("#send_btn").click(function() {
171
+ var queueName = $("#col_name_search").val();
172
+ var messageContent = $("#message_content").val();
173
+
174
+ if (!queueName) {
175
+ alert("请先选择队列名称");
176
+ return;
177
+ }
178
+
179
+ if (!messageContent) {
180
+ alert("请输入消息内容");
181
+ return;
182
+ }
183
+
184
+ try {
185
+ // 尝试解析JSON,确保内容有效
186
+ JSON.parse(messageContent);
187
+ } catch (e) {
188
+ alert("消息内容必须是有效的JSON格式");
189
+ return;
190
+ }
191
+
192
+ // 更新状态显示
193
+ $("#status_display").removeClass("alert-info alert-success alert-danger").addClass("alert-warning");
194
+ $("#status_display").text("正在发送RPC请求,请稍候...");
195
+
196
+ // 清空结果框
197
+ $("#rpc_result").val("");
198
+
199
+ // 发送RPC请求
200
+ $.ajax({
201
+ url: "{{ url_for('rpc_call') }}",
202
+ type: "POST",
203
+ contentType: "application/json",
204
+ data: JSON.stringify({
205
+ queue_name: queueName,
206
+ msg_body: JSON.parse(messageContent),
207
+ need_result: $("#need_result").is(":checked"),
208
+ timeout: parseInt($("#timeout").val())
209
+ }),
210
+ success: function(result) {
211
+
212
+ console.log(result)
213
+
214
+ $("#rpc_result").val(JSON.stringify(result, null, 2));
215
+
216
+ // 更新状态显示
217
+ if (result.succ) {
218
+ $("#status_display").removeClass("alert-warning alert-danger").addClass("alert-success");
219
+ $("#status_display").text("RPC请求成功: " + result.msg);
220
+ } else {
221
+ $("#status_display").removeClass("alert-warning alert-success").addClass("alert-danger");
222
+ $("#status_display").text("RPC请求失败: " + result.msg);
223
+ }
224
+ },
225
+ error: function(xhr, status, error) {
226
+ $("#rpc_result").val("请求失败: " + error);
227
+
228
+ // 更新状态显示
229
+ $("#status_display").removeClass("alert-warning alert-success").addClass("alert-danger");
230
+ $("#status_display").text("RPC请求发送失败: " + error);
231
+ }
232
+ });
233
+ });
234
+ });
235
+
236
+ // 添加获取结果功能
237
+ $(document).ready(function() {
238
+ // 获取结果按钮点击事件
239
+ $("#get_result_btn").click(function() {
240
+ var taskId = $("#task_id").val();
241
+
242
+ if (!taskId) {
243
+ alert("请先输入task_id");
244
+ return;
245
+ }
246
+
247
+ // 更新状态显示
248
+ $("#task_status_display").removeClass("alert-info alert-success alert-danger").addClass("alert-warning");
249
+ $("#task_status_display").text("正在获取结果,请稍候...");
250
+
251
+ // 清空结果框
252
+ $("#rpc_result").val("");
253
+
254
+ // 获取结果
255
+ $.ajax({
256
+ url: "{{ url_for('get_result_by_task_id') }}",
257
+ type: "GET",
258
+ data: {
259
+ task_id: taskId,
260
+ timeout: parseInt($("#task_timeout").val())
261
+ },
262
+ success: function(result) {
263
+ console.log(result);
264
+ $("#rpc_result").val(JSON.stringify(result, null, 2));
265
+
266
+ // 更新状态显示
267
+ if (result.succ) {
268
+ $("#task_status_display").removeClass("alert-warning alert-danger").addClass("alert-success");
269
+ $("#task_status_display").text("获取结果成功");
270
+ } else {
271
+ $("#task_status_display").removeClass("alert-warning alert-success").addClass("alert-danger");
272
+ $("#task_status_display").text("获取结果失败: " + result.msg);
273
+ }
274
+ },
275
+ error: function(xhr, status, error) {
276
+ $("#rpc_result").val("请求失败: " + error);
277
+
278
+ // 更新状态显示
279
+ $("#task_status_display").removeClass("alert-warning alert-success").addClass("alert-danger");
280
+ $("#task_status_display").text("获取结果失败: " + error);
281
+ }
282
+ });
283
+ });
284
+ });
285
+
286
+
287
+
288
+
289
+
290
+
291
+
292
+
293
+
294
+
295
+ </script>
296
+ </body>
297
+
298
+ </html>
@@ -87,7 +87,7 @@
87
87
  var html = '<option value="">请选择ip...</option>';
88
88
  for (var item of result) {
89
89
  html += '<option value="' + item.collection_name + '">' +
90
- item.collection_name + ' (' + item.count + ')</option>';
90
+ item.collection_name + '&nbsp;&nbsp;&nbsp;&nbsp;(consumer_count:' + item.count + ')</option>';
91
91
  }
92
92
  $("#col_name_search").html(html);
93
93
 
@@ -95,7 +95,7 @@
95
95
  $("#col_name_search").select2({
96
96
  placeholder: "请输入ip名称搜索...",
97
97
  allowClear: true,
98
- width: '300px'
98
+ width: '500px'
99
99
  });
100
100
 
101
101
  // 监听选择变化
@@ -87,7 +87,7 @@
87
87
  var html = '<option value="">请选择队列名字...</option>';
88
88
  for (var item of result) {
89
89
  html += '<option value="' + item.collection_name + '">' +
90
- item.collection_name + ' (' + item.count + ')</option>';
90
+ item.collection_name + '&nbsp;&nbsp;&nbsp;&nbsp;(consumer_count:' + item.count + ')</option>';
91
91
  }
92
92
  $("#col_name_search").html(html);
93
93
 
@@ -95,7 +95,7 @@
95
95
  $("#col_name_search").select2({
96
96
  placeholder: "请输入队列名称搜索...",
97
97
  allowClear: true,
98
- width: '300px'
98
+ width: '500px'
99
99
  });
100
100
 
101
101
  // 监听选择变化
@@ -47,7 +47,7 @@ class FunboostBackgroundSchedulerProcessJobsWithinRedisLock(FunboostBackgroundSc
47
47
  jobstores = {
48
48
  "default": RedisJobStore(db=BrokerConnConfig.REDIS_DB, host=BrokerConnConfig.REDIS_HOST,
49
49
  port=BrokerConnConfig.REDIS_PORT, password=BrokerConnConfig.REDIS_PASSWORD,
50
- username=BrokerConnConfig.REDIS_USERNAME, jobs_key='funboost.apscheduler.jobs')
50
+ username=BrokerConnConfig.REDIS_USERNAME, jobs_key='funboost.apscheduler.jobs',run_times_key="funboost.apscheduler.run_times")
51
51
  }
52
52
 
53
53
  funboost_background_scheduler_redis_store = FunboostBackgroundSchedulerProcessJobsWithinRedisLock(timezone=FunboostCommonConfig.TIMEZONE, daemon=False, jobstores=jobstores)
@@ -117,6 +117,8 @@ class FunboostBackgroundScheduler(BackgroundScheduler):
117
117
  args_list = list(args)
118
118
  args_list.insert(0, func.queue_name)
119
119
  args = tuple(args_list)
120
+ if name is None:
121
+ name = f'push_fun_params_to_broker_for_queue_{func.queue_name}'
120
122
  return self.add_job(push_fun_params_to_broker, trigger, args, kwargs, id, name,
121
123
  misfire_grace_time, coalesce, max_instances,
122
124
  next_run_time, jobstore, executor,
@@ -25,7 +25,7 @@ class ApsJobAdder:
25
25
 
26
26
  queue__redis_aps_map = {}
27
27
 
28
- def __init__(self, booster: Booster, job_store_kind: str = 'memory'):
28
+ def __init__(self, booster: Booster, job_store_kind: str = 'memory',is_auto_start=True,is_auto_paused=False):
29
29
  """
30
30
  Initialize the ApsJobAdder.
31
31
 
@@ -35,6 +35,12 @@ class ApsJobAdder:
35
35
  """
36
36
  self.booster = booster
37
37
  self.job_store_kind = job_store_kind
38
+ if getattr(self.aps_obj, 'has_started_flag', False) is False:
39
+ if is_auto_start:
40
+ self.aps_obj.has_started_flag = True
41
+ self.aps_obj.start(paused=is_auto_paused)
42
+
43
+
38
44
 
39
45
  @classmethod
40
46
  def get_funboost_redis_apscheduler(cls, queue_name):
@@ -75,9 +81,9 @@ class ApsJobAdder:
75
81
  funboost的ApsJobAdder对象.add_push_job入参去掉了函数,因为类的实例化时候会把函数传进来,不需要再麻烦用户一次了。
76
82
  """
77
83
 
78
- if not getattr(self.aps_obj, 'has_started_flag', False):
79
- self.aps_obj.has_started_flag = True
80
- self.aps_obj.start(paused=False)
84
+ # if not getattr(self.aps_obj, 'has_started_flag', False):
85
+ # self.aps_obj.has_started_flag = True
86
+ # self.aps_obj.start(paused=False)
81
87
  return self.aps_obj.add_push_job(self.booster, trigger, args, kwargs, id, name,
82
88
  misfire_grace_time, coalesce, max_instances,
83
89
  next_run_time, jobstore, executor,
@@ -1,9 +1,28 @@
1
1
  import os
2
2
  import sys
3
3
  import time
4
+ import signal
5
+
6
+
7
+ def signal_handler(signum, frame):
8
+ print(f'收到信号 {signum},程序准备退出', flush=True)
9
+ sys.exit(4)
10
+ os._exit(44)
4
11
 
5
12
 
6
13
  def ctrl_c_recv():
14
+ """
15
+ 主要目的就是阻止主线程退出而已。 因为funboost为了方便用户连续启动多个consume都是子线程运行循环调度的。
16
+ apscheduler background 类型必须有主线程在运行,否则会很快结束。所以需要阻止主线程退出。
17
+ 在代码最最末尾加上 ctrl_c_recv() 就可以阻止主线程退出。
18
+
19
+ 你也可以直接在你的启动脚本的最末尾加上:
20
+ while 1:
21
+ time.sleep(100)
22
+ 来达到阻止主线程退出的目的。
23
+ """
24
+ # signal.signal(signal.SIGTERM, signal_handler)
25
+
7
26
  for i in range(3):
8
27
  while 1:
9
28
  try:
@@ -14,6 +33,5 @@ def ctrl_c_recv():
14
33
  # time.sleep(2)
15
34
  break
16
35
  # sys.exit(4)
17
-
18
36
  os._exit(44)
19
37
  # exit(444)
@@ -1,3 +1,9 @@
1
+ ---
2
+ noteId: "b20b5950240511f0b39f3b947bbde921"
3
+ tags: []
4
+
5
+ ---
6
+
1
7
 
2
8
  ## 1 asioredis包将不再更新 ,ptyhon 3.11 版本 import aioredis会出错。
3
9
 
@@ -1,3 +1,9 @@
1
+ ---
2
+ noteId: "b20b5951240511f0b39f3b947bbde921"
3
+ tags: []
4
+
5
+ ---
6
+
1
7
  ## 这个文件夹被添加到 sys.path中去了。
2
8
 
3
9
  funboost __init__.py 第一行就把这个添加到 sys.path了,相当于 export PYTHONPATH 了。
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: funboost
3
- Version: 48.6
3
+ Version: 48.8
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
@@ -535,17 +535,21 @@ funboost web manager 截图:
535
535
  函数消费结果:可查看和搜索函数实时消费状态和结果
536
536
  [![pEJCffK.png](https://s21.ax1x.com/2025/03/04/pEJCffK.png)](https://imgse.com/i/pEJCffK)
537
537
 
538
+ 消费速度图:可查看实时和历史消费速度
539
+ [![pEJCWY6.png](https://s21.ax1x.com/2025/03/04/pEJCWY6.png)](https://imgse.com/i/pEJCWY6)
540
+
538
541
  运行中消费者 by ip: 根据ip搜索有哪些消费者
539
542
  [![pEJCRFx.png](https://s21.ax1x.com/2025/03/04/pEJCRFx.png)](https://imgse.com/i/pEJCRFx)
540
543
 
541
544
 
542
- 队列操作:查看和操作队列
545
+ 队列操作:查看和操作队列,包括 清空清空 暂停消费 恢复消费 调整qps和并发
543
546
  [![pEJC6m9.png](https://s21.ax1x.com/2025/03/04/pEJC6m9.png)](https://imgse.com/i/pEJC6m9)
544
547
 
545
548
  队列操作,查看消费者详情:查看队列的所有消费者详情
546
549
  [![pEJCgT1.png](https://s21.ax1x.com/2025/03/04/pEJCgT1.png)](https://imgse.com/i/pEJCgT1)
547
550
 
548
-
551
+ rpc调用:
552
+ [![pETq8hj.png](https://s21.ax1x.com/2025/04/28/pETq8hj.png)](https://imgse.com/i/pETq8hj)
549
553
 
550
554
  ## 1.4 python分布式函数执行为什么重要?
551
555