funboost 48.0__py3-none-any.whl → 48.2__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/constant.py +7 -0
- funboost/consumers/base_consumer.py +137 -68
- funboost/core/active_cousumer_info_getter.py +80 -0
- funboost/core/function_result_status_saver.py +1 -1
- funboost/function_result_web/__pycache__/functions.cpython-37.pyc +0 -0
- funboost/function_result_web/__pycache__/functions.cpython-39.pyc +0 -0
- funboost/function_result_web/app.py +104 -7
- funboost/function_result_web/functions.py +17 -4
- funboost/function_result_web/static/css/content_page_style.css +39 -0
- funboost/function_result_web/static/images/favicon.ico +0 -0
- funboost/function_result_web/static/js/bootstrap-datetimepicker.min.js +2 -0
- funboost/function_result_web/static/js/echarts.min.js +32478 -0
- funboost/function_result_web/static/js/moment-with-locales.min.js +1 -0
- funboost/function_result_web/static/js/select2.min.js +2 -0
- funboost/function_result_web/templates/about.html +67 -0
- funboost/function_result_web/templates/conusme_speed.html +217 -0
- funboost/function_result_web/templates/fun_result_table.html +433 -0
- funboost/function_result_web/templates/index.html +194 -423
- funboost/function_result_web/templates/index_backup.html +475 -0
- funboost/function_result_web/templates/index_/321/204/342/225/225/320/235/321/205/320/237/320/277/321/206/320/232/320/250/321/205/320/237/320/260.html +153 -0
- funboost/function_result_web/templates/queue_op.html +501 -0
- funboost/function_result_web/templates/running_consumer_by_ip.html +219 -0
- funboost/function_result_web/templates/running_consumer_by_queue_name.html +220 -0
- funboost/timing_job/timing_push.py +24 -24
- funboost/utils/dependency_packages_in_pythonpath/aioredis/readme.md +0 -6
- funboost/utils/dependency_packages_in_pythonpath/readme.md +0 -6
- {funboost-48.0.dist-info → funboost-48.2.dist-info}/METADATA +78 -76
- {funboost-48.0.dist-info → funboost-48.2.dist-info}/RECORD +33 -18
- {funboost-48.0.dist-info → funboost-48.2.dist-info}/WHEEL +1 -1
- {funboost-48.0.dist-info → funboost-48.2.dist-info}/LICENSE +0 -0
- {funboost-48.0.dist-info → funboost-48.2.dist-info}/entry_points.txt +0 -0
- {funboost-48.0.dist-info → funboost-48.2.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,219 @@
|
|
|
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="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
|
|
10
|
+
<link href="http://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
|
|
11
|
+
<link rel="stylesheet"
|
|
12
|
+
href="https://cdn.bootcss.com/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="https://cdn.bootcdn.net/ajax/libs/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="http://cdn.bootcss.com/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="https://unpkg.com/tabulator-tables@5.5.0/dist/css/tabulator.min.css" rel="stylesheet">
|
|
41
|
+
<link href="https://unpkg.com/tabulator-tables@5.5.0/dist/css/tabulator_bootstrap3.min.css" rel="stylesheet">
|
|
42
|
+
<script type="text/javascript" src="https://unpkg.com/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
|
+
<div style="margin-top: 5px;">
|
|
53
|
+
<form class="form-inline" role="form" style="">
|
|
54
|
+
<div class="form-group ">
|
|
55
|
+
<label for="col_name_search">host:</label>
|
|
56
|
+
<select class="form-control" id="col_name_search">
|
|
57
|
+
<option value="">请选择ip...</option>
|
|
58
|
+
</select>
|
|
59
|
+
</div>
|
|
60
|
+
<button type="button" class="btn btn-default marginLeft20" onclick="query()">查询</button>
|
|
61
|
+
</form>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<div id="result-table" style="margin-top: 20px;"></div>
|
|
65
|
+
|
|
66
|
+
</div>
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
<script>
|
|
74
|
+
|
|
75
|
+
// 在现有的变量声明后添加
|
|
76
|
+
var allQueues = []; // 存储所有队列数据
|
|
77
|
+
var currentColName;
|
|
78
|
+
|
|
79
|
+
// 页面加载完成后立即获取所有队列
|
|
80
|
+
$(document).ready(function () {
|
|
81
|
+
$.ajax({
|
|
82
|
+
url: "{{ url_for('hearbeat_info_partion_by_ip')}}",
|
|
83
|
+
data: { col_name_search: '' },
|
|
84
|
+
async: true,
|
|
85
|
+
success: function (result) {
|
|
86
|
+
allQueues = result;
|
|
87
|
+
var html = '<option value="">请选择ip...</option>';
|
|
88
|
+
for (var item of result) {
|
|
89
|
+
html += '<option value="' + item.collection_name + '">' +
|
|
90
|
+
item.collection_name + ' (' + item.count + ')</option>';
|
|
91
|
+
}
|
|
92
|
+
$("#col_name_search").html(html);
|
|
93
|
+
|
|
94
|
+
// 初始化选择框的搜索功能
|
|
95
|
+
$("#col_name_search").select2({
|
|
96
|
+
placeholder: "请输入ip名称搜索...",
|
|
97
|
+
allowClear: true,
|
|
98
|
+
width: '300px'
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
// 监听选择变化
|
|
102
|
+
$("#col_name_search").on('change', function () {
|
|
103
|
+
var selectedQueue = $(this).val();
|
|
104
|
+
console.log("Selected queue:", selectedQueue);
|
|
105
|
+
currentColName = selectedQueue;
|
|
106
|
+
// if(selectedQueue) {
|
|
107
|
+
// queryResult(selectedQueue, 0, true);
|
|
108
|
+
// }
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
$(document).ready(function (){
|
|
115
|
+
query()
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
function query() {
|
|
120
|
+
$.ajax({
|
|
121
|
+
url: "{{ url_for('hearbeat_info_by_ip')}}",
|
|
122
|
+
data: { ip: currentColName },
|
|
123
|
+
async: true,
|
|
124
|
+
success: function (result) {
|
|
125
|
+
console.info(result);
|
|
126
|
+
|
|
127
|
+
// 创建表格
|
|
128
|
+
var table = new Tabulator("#result-table", {
|
|
129
|
+
theme: "bootstrap3",
|
|
130
|
+
data: result,
|
|
131
|
+
// layout: "fitColumns",
|
|
132
|
+
layout: "fitDataTable", // 改为 fitDataTable
|
|
133
|
+
responsiveLayout: false, // 禁用响应式布局
|
|
134
|
+
columns: [
|
|
135
|
+
{title: "<br><br>队列名称", field: "queue_name"},
|
|
136
|
+
{title: "<br><br>消费函数", field: "consuming_function"},
|
|
137
|
+
{title: "<br><br>主机名", field: "computer_name"},
|
|
138
|
+
{title: "<br><br>IP地址", field: "computer_ip"},
|
|
139
|
+
{title: "<br><br>进程ID", field: "process_id"},
|
|
140
|
+
{title: "<br><br>启动时间", field: "start_datetime_str","width":200},
|
|
141
|
+
{title: "<br><br>最近心跳时间", field: "hearbeat_datetime_str","width":200},
|
|
142
|
+
|
|
143
|
+
{title:"近10秒<br>运行完成<br>消息个数",field:"last_x_s_execute_count", formatter:"html","width":100},
|
|
144
|
+
{title:"近10秒<br>运行失败<br>消息个数",field:"last_x_s_execute_count_fail", formatter:"html","width":100},
|
|
145
|
+
{title:"近10秒<br>函数运行<br>平均耗时",field:"last_x_s_avarage_function_spend_time", formatter:"html","width":100},
|
|
146
|
+
|
|
147
|
+
{title:"累计<br>运行完成<br>消息个数",field:"total_consume_count_from_start", formatter:"html","width":100},
|
|
148
|
+
{title:"累计<br>运行失败<br>消息个数",field:"total_consume_count_from_start_fail", formatter:"html","width":100},
|
|
149
|
+
{title:"累计<br>函数运行<br>平均耗时",field:"avarage_function_spend_time_from_start", formatter:"html","width":100},
|
|
150
|
+
|
|
151
|
+
{title: "<br><br>代码文件", field: "code_filename"},
|
|
152
|
+
// {title: "<br><br>consumer_id", field: "consumer_id"},
|
|
153
|
+
{title: "<br><br>consumer_uuid", field: "consumer_uuid"},
|
|
154
|
+
],
|
|
155
|
+
pagination: true,
|
|
156
|
+
paginationSize: 1000,
|
|
157
|
+
locale: true,
|
|
158
|
+
langs: {
|
|
159
|
+
"zh-cn": {
|
|
160
|
+
"pagination": {
|
|
161
|
+
"first": "首页",
|
|
162
|
+
"first_title": "首页",
|
|
163
|
+
"last": "末页",
|
|
164
|
+
"last_title": "末页",
|
|
165
|
+
"prev": "上一页",
|
|
166
|
+
"prev_title": "上一页",
|
|
167
|
+
"next": "下一页",
|
|
168
|
+
"next_title": "下一页",
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
/* result 例如 [
|
|
174
|
+
{
|
|
175
|
+
"code_filename": "d:/codes/funboost/test_frame/test_function_status_result_persist/test_persist.py",
|
|
176
|
+
"computer_ip": "10.0.133.57",
|
|
177
|
+
"computer_name": "LAPTOP-7V78BBO2",
|
|
178
|
+
"consumer_id": 1462882757512,
|
|
179
|
+
"consumer_uuid": "88f568f7-9723-48ef-9cac-0370b2333a49",
|
|
180
|
+
"consuming_function": "f2",
|
|
181
|
+
"hearbeat_datetime_str": "2025-02-25 17:28:36",
|
|
182
|
+
"hearbeat_timestamp": 1740475716.783474,
|
|
183
|
+
"process_id": 34788,
|
|
184
|
+
"queue_name": "queue_test_f02t",
|
|
185
|
+
"start_datetime_str": "2025-02-25 16:33:19",
|
|
186
|
+
"start_timestamp": 1740472399.4628778
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"code_filename": "d:/codes/funboost/test_frame/test_function_status_result_persist/test_persist.py",
|
|
190
|
+
"computer_ip": "10.0.133.57",
|
|
191
|
+
"computer_name": "LAPTOP-7V78BBO2",
|
|
192
|
+
"consumer_id": 1462882671944,
|
|
193
|
+
"consumer_uuid": "c52a8596-d632-4bac-a797-80375288f381",
|
|
194
|
+
"consuming_function": "f",
|
|
195
|
+
"hearbeat_datetime_str": "2025-02-25 17:28:36",
|
|
196
|
+
"hearbeat_timestamp": 1740475716.783336,
|
|
197
|
+
"process_id": 34788,
|
|
198
|
+
"queue_name": "queue_test_f01t",
|
|
199
|
+
"start_datetime_str": "2025-02-25 16:33:19",
|
|
200
|
+
"start_timestamp": 1740472399.4503505
|
|
201
|
+
}
|
|
202
|
+
]
|
|
203
|
+
*/
|
|
204
|
+
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
</script>
|
|
217
|
+
</body>
|
|
218
|
+
|
|
219
|
+
</html>
|
|
@@ -0,0 +1,220 @@
|
|
|
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="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
|
|
10
|
+
<link href="http://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
|
|
11
|
+
<link rel="stylesheet"
|
|
12
|
+
href="https://cdn.bootcss.com/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="https://cdn.bootcdn.net/ajax/libs/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="http://cdn.bootcss.com/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="https://unpkg.com/tabulator-tables@5.5.0/dist/css/tabulator.min.css" rel="stylesheet">
|
|
41
|
+
<link href="https://unpkg.com/tabulator-tables@5.5.0/dist/css/tabulator_bootstrap3.min.css" rel="stylesheet">
|
|
42
|
+
<script type="text/javascript" src="https://unpkg.com/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
|
+
<div style="margin-top: 5px;">
|
|
53
|
+
<form class="form-inline" role="form" style="">
|
|
54
|
+
<div class="form-group ">
|
|
55
|
+
<label for="col_name_search">队列名字:</label>
|
|
56
|
+
<select class="form-control" id="col_name_search">
|
|
57
|
+
<option value="">请选择队列名字...</option>
|
|
58
|
+
</select>
|
|
59
|
+
</div>
|
|
60
|
+
<button type="button" class="btn btn-default marginLeft20" onclick="query()">查询</button>
|
|
61
|
+
</form>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<div id="result-table" style="margin-top: 20px;"></div>
|
|
65
|
+
|
|
66
|
+
</div>
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
<script>
|
|
74
|
+
|
|
75
|
+
// 在现有的变量声明后添加
|
|
76
|
+
var allQueues = []; // 存储所有队列数据
|
|
77
|
+
var currentColName;
|
|
78
|
+
|
|
79
|
+
// 页面加载完成后立即获取所有队列
|
|
80
|
+
$(document).ready(function () {
|
|
81
|
+
$.ajax({
|
|
82
|
+
url: "{{ url_for('hearbeat_info_partion_by_queue_name')}}",
|
|
83
|
+
data: { col_name_search: '' },
|
|
84
|
+
async: true,
|
|
85
|
+
success: function (result) {
|
|
86
|
+
allQueues = result;
|
|
87
|
+
var html = '<option value="">请选择队列名字...</option>';
|
|
88
|
+
for (var item of result) {
|
|
89
|
+
html += '<option value="' + item.collection_name + '">' +
|
|
90
|
+
item.collection_name + ' (' + item.count + ')</option>';
|
|
91
|
+
}
|
|
92
|
+
$("#col_name_search").html(html);
|
|
93
|
+
|
|
94
|
+
// 初始化选择框的搜索功能
|
|
95
|
+
$("#col_name_search").select2({
|
|
96
|
+
placeholder: "请输入队列名称搜索...",
|
|
97
|
+
allowClear: true,
|
|
98
|
+
width: '300px'
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
// 监听选择变化
|
|
102
|
+
$("#col_name_search").on('change', function () {
|
|
103
|
+
var selectedQueue = $(this).val();
|
|
104
|
+
console.log("Selected queue:", selectedQueue);
|
|
105
|
+
currentColName = selectedQueue;
|
|
106
|
+
// if(selectedQueue) {
|
|
107
|
+
// queryResult(selectedQueue, 0, true);
|
|
108
|
+
// }
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
$(document).ready(function (){
|
|
115
|
+
query()
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
function query() {
|
|
119
|
+
$.ajax({
|
|
120
|
+
url: "{{ url_for('hearbeat_info_by_queue_name')}}",
|
|
121
|
+
data: { queue_name: currentColName },
|
|
122
|
+
async: true,
|
|
123
|
+
success: function (result) {
|
|
124
|
+
console.info(result);
|
|
125
|
+
|
|
126
|
+
// 创建表格
|
|
127
|
+
var table = new Tabulator("#result-table", {
|
|
128
|
+
theme: "bootstrap3",
|
|
129
|
+
data: result,
|
|
130
|
+
|
|
131
|
+
// layout: "fitColumns",
|
|
132
|
+
layout: "fitDataTable", // 改为 fitDataTable
|
|
133
|
+
responsiveLayout: false, // 禁用响应式布局
|
|
134
|
+
columns: [
|
|
135
|
+
{title: "<br><br>队列名称", field: "queue_name"},
|
|
136
|
+
{title: "<br><br>消费函数", field: "consuming_function"},
|
|
137
|
+
{title: "<br><br>主机名", field: "computer_name"},
|
|
138
|
+
{title: "<br><br>IP地址", field: "computer_ip"},
|
|
139
|
+
{title: "<br><br>进程ID", field: "process_id"},
|
|
140
|
+
{title: "<br><br>启动时间", field: "start_datetime_str","width":200},
|
|
141
|
+
{title: "<br><br>最近心跳时间", field: "hearbeat_datetime_str","width":200},
|
|
142
|
+
|
|
143
|
+
{title:"近10秒<br>运行完成<br>消息个数",field:"last_x_s_execute_count", formatter:"html","width":100},
|
|
144
|
+
{title:"近10秒<br>运行失败<br>消息个数",field:"last_x_s_execute_count_fail", formatter:"html","width":100},
|
|
145
|
+
{title:"近10秒<br>函数运行<br>平均耗时",field:"last_x_s_avarage_function_spend_time", formatter:"html","width":100},
|
|
146
|
+
|
|
147
|
+
{title:"累计<br>运行完成<br>消息个数",field:"total_consume_count_from_start", formatter:"html","width":100},
|
|
148
|
+
{title:"累计<br>运行失败<br>消息个数",field:"total_consume_count_from_start_fail", formatter:"html","width":100},
|
|
149
|
+
{title:"累计<br>函数运行<br>平均耗时",field:"avarage_function_spend_time_from_start", formatter:"html","width":100},
|
|
150
|
+
|
|
151
|
+
{title: "<br><br>代码文件", field: "code_filename"},
|
|
152
|
+
// {title: "<br><br>consumer_id", field: "consumer_id"},
|
|
153
|
+
{title: "<br><br>consumer_uuid", field: "consumer_uuid"},
|
|
154
|
+
],
|
|
155
|
+
pagination: true,
|
|
156
|
+
paginationSize: 1000,
|
|
157
|
+
locale: true,
|
|
158
|
+
langs: {
|
|
159
|
+
"zh-cn": {
|
|
160
|
+
"pagination": {
|
|
161
|
+
"first": "首页",
|
|
162
|
+
"first_title": "首页",
|
|
163
|
+
"last": "末页",
|
|
164
|
+
"last_title": "末页",
|
|
165
|
+
"prev": "上一页",
|
|
166
|
+
"prev_title": "上一页",
|
|
167
|
+
"next": "下一页",
|
|
168
|
+
"next_title": "下一页",
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
/* result 例如 [
|
|
175
|
+
{
|
|
176
|
+
"code_filename": "d:/codes/funboost/test_frame/test_function_status_result_persist/test_persist.py",
|
|
177
|
+
"computer_ip": "10.0.133.57",
|
|
178
|
+
"computer_name": "LAPTOP-7V78BBO2",
|
|
179
|
+
"consumer_id": 1462882757512,
|
|
180
|
+
"consumer_uuid": "88f568f7-9723-48ef-9cac-0370b2333a49",
|
|
181
|
+
"consuming_function": "f2",
|
|
182
|
+
"hearbeat_datetime_str": "2025-02-25 17:28:36",
|
|
183
|
+
"hearbeat_timestamp": 1740475716.783474,
|
|
184
|
+
"process_id": 34788,
|
|
185
|
+
"queue_name": "queue_test_f02t",
|
|
186
|
+
"start_datetime_str": "2025-02-25 16:33:19",
|
|
187
|
+
"start_timestamp": 1740472399.4628778
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"code_filename": "d:/codes/funboost/test_frame/test_function_status_result_persist/test_persist.py",
|
|
191
|
+
"computer_ip": "10.0.133.57",
|
|
192
|
+
"computer_name": "LAPTOP-7V78BBO2",
|
|
193
|
+
"consumer_id": 1462882671944,
|
|
194
|
+
"consumer_uuid": "c52a8596-d632-4bac-a797-80375288f381",
|
|
195
|
+
"consuming_function": "f",
|
|
196
|
+
"hearbeat_datetime_str": "2025-02-25 17:28:36",
|
|
197
|
+
"hearbeat_timestamp": 1740475716.783336,
|
|
198
|
+
"process_id": 34788,
|
|
199
|
+
"queue_name": "queue_test_f01t",
|
|
200
|
+
"start_datetime_str": "2025-02-25 16:33:19",
|
|
201
|
+
"start_timestamp": 1740472399.4503505
|
|
202
|
+
}
|
|
203
|
+
]
|
|
204
|
+
*/
|
|
205
|
+
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
</script>
|
|
218
|
+
</body>
|
|
219
|
+
|
|
220
|
+
</html>
|
|
@@ -5,6 +5,7 @@ from apscheduler.jobstores.redis import RedisJobStore
|
|
|
5
5
|
from funboost.timing_job.timing_job_base import funboost_aps_scheduler, undefined
|
|
6
6
|
from funboost.timing_job.apscheduler_use_redis_store import FunboostBackgroundSchedulerProcessJobsWithinRedisLock
|
|
7
7
|
from funboost.funboost_config_deafult import FunboostCommonConfig
|
|
8
|
+
from apscheduler.schedulers.base import BaseScheduler
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
class ApsJobAdder:
|
|
@@ -55,7 +56,7 @@ class ApsJobAdder:
|
|
|
55
56
|
return redis_aps
|
|
56
57
|
|
|
57
58
|
@property
|
|
58
|
-
def aps_obj(self):
|
|
59
|
+
def aps_obj(self) -> BaseScheduler:
|
|
59
60
|
if self.job_store_kind == 'redis':
|
|
60
61
|
return self.get_funboost_redis_apscheduler(self.booster.queue_name)
|
|
61
62
|
elif self.job_store_kind == 'memory':
|
|
@@ -63,17 +64,17 @@ class ApsJobAdder:
|
|
|
63
64
|
else:
|
|
64
65
|
raise ValueError('Unsupported job_store_kind')
|
|
65
66
|
|
|
66
|
-
def add_push_job(self, trigger=None, args=None, kwargs=None,
|
|
67
|
+
def add_push_job(self, trigger=None, args=None, kwargs=None,
|
|
67
68
|
id=None, name=None,
|
|
68
69
|
misfire_grace_time=undefined, coalesce=undefined, max_instances=undefined,
|
|
69
70
|
next_run_time=undefined, jobstore='default', executor='default',
|
|
70
|
-
replace_existing=False, **trigger_args,):
|
|
71
|
+
replace_existing=False, **trigger_args, ):
|
|
71
72
|
"""
|
|
72
73
|
这里的入参都是和apscheduler的add_job的入参一样的,funboost作者没有创造新的入参。
|
|
73
74
|
但是官方apscheduler的入参第一个入参是函数,
|
|
74
75
|
funboost的ApsJobAdder对象.add_push_job入参去掉了函数,因为类的实例化时候会把函数传进来,不需要再麻烦用户一次了。
|
|
75
76
|
"""
|
|
76
|
-
|
|
77
|
+
|
|
77
78
|
if not getattr(self.aps_obj, 'has_started_flag', False):
|
|
78
79
|
self.aps_obj.has_started_flag = True
|
|
79
80
|
self.aps_obj.start(paused=False)
|
|
@@ -83,54 +84,53 @@ class ApsJobAdder:
|
|
|
83
84
|
replace_existing, **trigger_args, )
|
|
84
85
|
|
|
85
86
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
87
|
if __name__ == '__main__':
|
|
90
88
|
"""
|
|
91
89
|
2025年后定时任务现在推荐使用 ApsJobAdder 写法 ,用户不需要亲自选择使用 apscheduler对象来添加定时任务
|
|
92
90
|
"""
|
|
93
|
-
from funboost import boost, BrokerEnum,ctrl_c_recv,BoosterParams,ApsJobAdder
|
|
94
|
-
|
|
91
|
+
from funboost import boost, BrokerEnum, ctrl_c_recv, BoosterParams, ApsJobAdder
|
|
92
|
+
|
|
95
93
|
|
|
96
94
|
# 定义任务处理函数
|
|
97
95
|
@BoosterParams(queue_name='sum_queue3', broker_kind=BrokerEnum.REDIS)
|
|
98
|
-
def sum_two_numbers(x, y):
|
|
99
|
-
result = x + y
|
|
100
|
-
print(f'The sum of {x} and {y} is {result}')
|
|
101
|
-
|
|
96
|
+
def sum_two_numbers(x, y):
|
|
97
|
+
result = x + y
|
|
98
|
+
print(f'The sum of {x} and {y} is {result}')
|
|
99
|
+
|
|
102
100
|
# 启动消费者
|
|
103
101
|
sum_two_numbers.consume()
|
|
104
|
-
|
|
102
|
+
|
|
105
103
|
# 发布任务
|
|
106
104
|
sum_two_numbers.push(3, 5)
|
|
107
105
|
sum_two_numbers.push(10, 20)
|
|
108
|
-
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
109
|
# 使用ApsJobAdder添加定时任务, 里面的定时语法,和apscheduler是一样的,用户需要自己熟悉知名框架apscheduler的add_job定时入参
|
|
110
110
|
|
|
111
111
|
# 方式1:指定日期执行一次
|
|
112
112
|
ApsJobAdder(sum_two_numbers, job_store_kind='redis').add_push_job(
|
|
113
113
|
trigger='date',
|
|
114
|
-
run_date='2025-01-17 23:25:40',
|
|
114
|
+
run_date='2025-01-17 23:25:40',
|
|
115
115
|
args=(7, 8)
|
|
116
116
|
)
|
|
117
117
|
|
|
118
118
|
# 方式2:固定间隔执行
|
|
119
119
|
ApsJobAdder(sum_two_numbers, job_store_kind='memory').add_push_job(
|
|
120
|
-
trigger='interval',
|
|
121
|
-
seconds=5,
|
|
120
|
+
trigger='interval',
|
|
121
|
+
seconds=5,
|
|
122
122
|
args=(4, 6)
|
|
123
123
|
)
|
|
124
124
|
|
|
125
125
|
# 方式3:使用cron表达式定时执行
|
|
126
126
|
ApsJobAdder(sum_two_numbers, job_store_kind='redis').add_push_job(
|
|
127
127
|
trigger='cron',
|
|
128
|
-
day_of_week='*',
|
|
129
|
-
hour=23,
|
|
130
|
-
minute=49,
|
|
128
|
+
day_of_week='*',
|
|
129
|
+
hour=23,
|
|
130
|
+
minute=49,
|
|
131
131
|
second=50,
|
|
132
|
-
kwargs={"x":50,"y":60},
|
|
132
|
+
kwargs={"x": 50, "y": 60},
|
|
133
133
|
replace_existing=True,
|
|
134
134
|
id='cron_job1')
|
|
135
|
-
|
|
136
|
-
ctrl_c_recv()
|
|
135
|
+
|
|
136
|
+
ctrl_c_recv()
|