jettask 0.2.15__py3-none-any.whl → 0.2.16__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.
Files changed (148) hide show
  1. jettask/__init__.py +14 -35
  2. jettask/{webui/__main__.py → __main__.py} +4 -4
  3. jettask/api/__init__.py +103 -0
  4. jettask/api/v1/__init__.py +29 -0
  5. jettask/api/v1/alerts.py +226 -0
  6. jettask/api/v1/analytics.py +323 -0
  7. jettask/api/v1/namespaces.py +134 -0
  8. jettask/api/v1/overview.py +136 -0
  9. jettask/api/v1/queues.py +530 -0
  10. jettask/api/v1/scheduled.py +420 -0
  11. jettask/api/v1/settings.py +44 -0
  12. jettask/{webui/api.py → api.py} +4 -46
  13. jettask/{webui/backend → backend}/main.py +21 -109
  14. jettask/{webui/backend → backend}/main_unified.py +1 -1
  15. jettask/{webui/backend → backend}/namespace_api_old.py +3 -30
  16. jettask/{webui/backend → backend}/namespace_data_access.py +2 -1
  17. jettask/{webui/backend → backend}/unified_api_router.py +14 -74
  18. jettask/{core/cli.py → cli.py} +106 -26
  19. jettask/config/nacos_config.py +386 -0
  20. jettask/core/app.py +8 -100
  21. jettask/core/db_manager.py +515 -0
  22. jettask/core/event_pool.py +5 -2
  23. jettask/core/unified_manager_base.py +47 -14
  24. jettask/{webui/db_init.py → db_init.py} +1 -1
  25. jettask/executors/asyncio.py +2 -2
  26. jettask/{webui/integrated_gradio_app.py → integrated_gradio_app.py} +1 -1
  27. jettask/{webui/multi_namespace_consumer.py → multi_namespace_consumer.py} +5 -2
  28. jettask/{webui/pg_consumer.py → pg_consumer.py} +137 -69
  29. jettask/{webui/run.py → run.py} +1 -1
  30. jettask/{webui/run_webui.py → run_webui.py} +4 -4
  31. jettask/scheduler/multi_namespace_scheduler.py +2 -2
  32. jettask/scheduler/unified_manager.py +5 -5
  33. jettask/scheduler/unified_scheduler_manager.py +1 -1
  34. jettask/schemas/__init__.py +166 -0
  35. jettask/schemas/alert.py +99 -0
  36. jettask/schemas/backlog.py +122 -0
  37. jettask/schemas/common.py +139 -0
  38. jettask/schemas/monitoring.py +181 -0
  39. jettask/schemas/namespace.py +168 -0
  40. jettask/schemas/queue.py +83 -0
  41. jettask/schemas/scheduled_task.py +128 -0
  42. jettask/schemas/task.py +70 -0
  43. jettask/services/__init__.py +24 -0
  44. jettask/services/alert_service.py +454 -0
  45. jettask/services/analytics_service.py +46 -0
  46. jettask/services/overview_service.py +978 -0
  47. jettask/services/queue_service.py +711 -0
  48. jettask/services/redis_monitor_service.py +151 -0
  49. jettask/services/scheduled_task_service.py +207 -0
  50. jettask/services/settings_service.py +758 -0
  51. jettask/services/task_service.py +157 -0
  52. jettask/{webui/task_center.py → task_center.py} +30 -8
  53. jettask/{webui/task_center_client.py → task_center_client.py} +1 -1
  54. jettask/{webui/config.py → webui_config.py} +6 -1
  55. jettask/webui_exceptions.py +67 -0
  56. jettask/webui_sql/verify_database.sql +72 -0
  57. {jettask-0.2.15.dist-info → jettask-0.2.16.dist-info}/METADATA +2 -1
  58. jettask-0.2.16.dist-info/RECORD +150 -0
  59. {jettask-0.2.15.dist-info → jettask-0.2.16.dist-info}/entry_points.txt +1 -1
  60. jettask/webui/backend/data_api.py +0 -3294
  61. jettask/webui/backend/namespace_api.py +0 -295
  62. jettask/webui/backend/queue_backlog_api.py +0 -727
  63. jettask/webui/backend/redis_monitor_api.py +0 -476
  64. jettask/webui/frontend/index.html +0 -13
  65. jettask/webui/frontend/package.json +0 -30
  66. jettask/webui/frontend/src/App.css +0 -109
  67. jettask/webui/frontend/src/App.jsx +0 -66
  68. jettask/webui/frontend/src/components/NamespaceSelector.jsx +0 -166
  69. jettask/webui/frontend/src/components/QueueBacklogChart.jsx +0 -298
  70. jettask/webui/frontend/src/components/QueueBacklogTrend.jsx +0 -638
  71. jettask/webui/frontend/src/components/QueueDetailsTable.css +0 -65
  72. jettask/webui/frontend/src/components/QueueDetailsTable.jsx +0 -487
  73. jettask/webui/frontend/src/components/QueueDetailsTableV2.jsx +0 -465
  74. jettask/webui/frontend/src/components/ScheduledTaskFilter.jsx +0 -423
  75. jettask/webui/frontend/src/components/TaskFilter.jsx +0 -425
  76. jettask/webui/frontend/src/components/TimeRangeSelector.css +0 -21
  77. jettask/webui/frontend/src/components/TimeRangeSelector.jsx +0 -160
  78. jettask/webui/frontend/src/components/charts/QueueChart.jsx +0 -111
  79. jettask/webui/frontend/src/components/charts/QueueTrendChart.jsx +0 -115
  80. jettask/webui/frontend/src/components/charts/WorkerChart.jsx +0 -40
  81. jettask/webui/frontend/src/components/common/StatsCard.jsx +0 -18
  82. jettask/webui/frontend/src/components/layout/AppLayout.css +0 -95
  83. jettask/webui/frontend/src/components/layout/AppLayout.jsx +0 -49
  84. jettask/webui/frontend/src/components/layout/Header.css +0 -106
  85. jettask/webui/frontend/src/components/layout/Header.jsx +0 -106
  86. jettask/webui/frontend/src/components/layout/SideMenu.css +0 -137
  87. jettask/webui/frontend/src/components/layout/SideMenu.jsx +0 -209
  88. jettask/webui/frontend/src/components/layout/TabsNav.css +0 -244
  89. jettask/webui/frontend/src/components/layout/TabsNav.jsx +0 -206
  90. jettask/webui/frontend/src/components/layout/UserInfo.css +0 -197
  91. jettask/webui/frontend/src/components/layout/UserInfo.jsx +0 -197
  92. jettask/webui/frontend/src/contexts/LoadingContext.jsx +0 -27
  93. jettask/webui/frontend/src/contexts/NamespaceContext.jsx +0 -72
  94. jettask/webui/frontend/src/contexts/TabsContext.backup.jsx +0 -245
  95. jettask/webui/frontend/src/index.css +0 -114
  96. jettask/webui/frontend/src/main.jsx +0 -22
  97. jettask/webui/frontend/src/pages/Alerts.jsx +0 -684
  98. jettask/webui/frontend/src/pages/Dashboard/index.css +0 -35
  99. jettask/webui/frontend/src/pages/Dashboard/index.jsx +0 -281
  100. jettask/webui/frontend/src/pages/Dashboard.jsx +0 -1330
  101. jettask/webui/frontend/src/pages/QueueDetail.jsx +0 -1117
  102. jettask/webui/frontend/src/pages/QueueMonitor.jsx +0 -527
  103. jettask/webui/frontend/src/pages/Queues.jsx +0 -12
  104. jettask/webui/frontend/src/pages/ScheduledTasks.jsx +0 -810
  105. jettask/webui/frontend/src/pages/Settings.jsx +0 -801
  106. jettask/webui/frontend/src/pages/Workers.jsx +0 -12
  107. jettask/webui/frontend/src/services/api.js +0 -159
  108. jettask/webui/frontend/src/services/queueTrend.js +0 -166
  109. jettask/webui/frontend/src/utils/suppressWarnings.js +0 -22
  110. jettask/webui/frontend/src/utils/userPreferences.js +0 -154
  111. jettask/webui/frontend/vite.config.js +0 -26
  112. jettask/webui/sql/init_database.sql +0 -640
  113. jettask-0.2.15.dist-info/RECORD +0 -172
  114. /jettask/{webui/backend → backend}/__init__.py +0 -0
  115. /jettask/{webui/backend → backend}/api/__init__.py +0 -0
  116. /jettask/{webui/backend → backend}/api/v1/__init__.py +0 -0
  117. /jettask/{webui/backend → backend}/api/v1/monitoring.py +0 -0
  118. /jettask/{webui/backend → backend}/api/v1/namespaces.py +0 -0
  119. /jettask/{webui/backend → backend}/api/v1/queues.py +0 -0
  120. /jettask/{webui/backend → backend}/api/v1/tasks.py +0 -0
  121. /jettask/{webui/backend → backend}/config.py +0 -0
  122. /jettask/{webui/backend → backend}/core/__init__.py +0 -0
  123. /jettask/{webui/backend → backend}/core/cache.py +0 -0
  124. /jettask/{webui/backend → backend}/core/database.py +0 -0
  125. /jettask/{webui/backend → backend}/core/exceptions.py +0 -0
  126. /jettask/{webui/backend → backend}/data_access.py +0 -0
  127. /jettask/{webui/backend → backend}/dependencies.py +0 -0
  128. /jettask/{webui/backend → backend}/init_meta_db.py +0 -0
  129. /jettask/{webui/backend → backend}/main_v2.py +0 -0
  130. /jettask/{webui/backend → backend}/models/__init__.py +0 -0
  131. /jettask/{webui/backend → backend}/models/requests.py +0 -0
  132. /jettask/{webui/backend → backend}/models/responses.py +0 -0
  133. /jettask/{webui/backend → backend}/queue_stats_v2.py +0 -0
  134. /jettask/{webui/backend → backend}/services/__init__.py +0 -0
  135. /jettask/{webui/backend → backend}/start.py +0 -0
  136. /jettask/{webui/cleanup_deprecated_tables.sql → cleanup_deprecated_tables.sql} +0 -0
  137. /jettask/{webui/gradio_app.py → gradio_app.py} +0 -0
  138. /jettask/{webui/__init__.py → main.py} +0 -0
  139. /jettask/{webui/models.py → models.py} +0 -0
  140. /jettask/{webui/run_monitor.py → run_monitor.py} +0 -0
  141. /jettask/{webui/schema.sql → schema.sql} +0 -0
  142. /jettask/{webui/unified_consumer_manager.py → unified_consumer_manager.py} +0 -0
  143. /jettask/{webui/models → webui_models}/__init__.py +0 -0
  144. /jettask/{webui/models → webui_models}/namespace.py +0 -0
  145. /jettask/{webui/sql → webui_sql}/batch_upsert_functions.sql +0 -0
  146. {jettask-0.2.15.dist-info → jettask-0.2.16.dist-info}/WHEEL +0 -0
  147. {jettask-0.2.15.dist-info → jettask-0.2.16.dist-info}/licenses/LICENSE +0 -0
  148. {jettask-0.2.15.dist-info → jettask-0.2.16.dist-info}/top_level.txt +0 -0
@@ -1,35 +0,0 @@
1
- .dashboard-container {
2
- padding: 24px;
3
- }
4
-
5
- .stats-row {
6
- margin-bottom: 24px;
7
- }
8
-
9
- .chart-controls {
10
- margin-bottom: 16px;
11
- }
12
-
13
- .connection-status {
14
- display: inline-flex;
15
- align-items: center;
16
- gap: 8px;
17
- padding: 4px 12px;
18
- border-radius: 4px;
19
- font-size: 12px;
20
- }
21
-
22
- .connection-status.connected {
23
- background-color: #f6ffed;
24
- color: #52c41a;
25
- }
26
-
27
- .connection-status.disconnected {
28
- background-color: #fff2e8;
29
- color: #fa8c16;
30
- }
31
-
32
- .connection-status.error {
33
- background-color: #fff1f0;
34
- color: #ff4d4f;
35
- }
@@ -1,281 +0,0 @@
1
- import React, { useState, useEffect, useRef, useCallback } from 'react'
2
- import { Row, Col, Card, Statistic, Space, Button, DatePicker, message, Spin } from 'antd'
3
- import {
4
- RocketOutlined,
5
- TeamOutlined,
6
- AppstoreOutlined,
7
- CheckCircleOutlined,
8
- CloseCircleOutlined,
9
- SyncOutlined,
10
- ClockCircleOutlined
11
- } from '@ant-design/icons'
12
- import dayjs from 'dayjs'
13
- import StatsCard from '../../components/common/StatsCard'
14
- import QueueChart from '../../components/charts/QueueChart'
15
- import WorkerChart from '../../components/charts/WorkerChart'
16
- import { fetchGlobalStats, fetchQueues, connectWebSocket } from '../../services/api'
17
- import './index.css'
18
-
19
- const { RangePicker } = DatePicker
20
-
21
- const Dashboard = () => {
22
- // 状态管理
23
- const [loading, setLoading] = useState(true)
24
- const [globalStats, setGlobalStats] = useState({
25
- total_workers: 0,
26
- online_workers: 0,
27
- total_queues: 0,
28
- active_queues: 0,
29
- total_tasks: 0,
30
- pending_tasks: 0,
31
- running_tasks: 0,
32
- completed_tasks: 0,
33
- failed_tasks: 0
34
- })
35
- const [queues, setQueues] = useState([])
36
- const [workers, setWorkers] = useState([])
37
- const [connectionStatus, setConnectionStatus] = useState('disconnected')
38
-
39
- // 图表时间范围
40
- const [chartTimeRange, setChartTimeRange] = useState('1h')
41
- const [customTimeRange, setCustomTimeRange] = useState(null)
42
-
43
- // WebSocket 引用
44
- const wsRef = useRef(null)
45
-
46
- // 时间范围选项
47
- const timeRangeOptions = [
48
- { label: '15分钟', value: '15m' },
49
- { label: '30分钟', value: '30m' },
50
- { label: '1小时', value: '1h' },
51
- { label: '3小时', value: '3h' },
52
- { label: '6小时', value: '6h' },
53
- { label: '12小时', value: '12h' },
54
- { label: '24小时', value: '24h' },
55
- { label: '3天', value: '3d' },
56
- { label: '7天', value: '7d' },
57
- ]
58
-
59
- // 获取数据
60
- const fetchData = useCallback(async () => {
61
- try {
62
- setLoading(true)
63
-
64
- // 获取全局统计
65
- const stats = await fetchGlobalStats()
66
- setGlobalStats(stats)
67
-
68
- // 获取队列列表
69
- const queuesData = await fetchQueues()
70
- setQueues(queuesData.queues || [])
71
-
72
- } catch (error) {
73
- console.error('Failed to fetch data:', error)
74
- message.error('获取数据失败')
75
- } finally {
76
- setLoading(false)
77
- }
78
- }, [])
79
-
80
- // WebSocket 连接
81
- const setupWebSocket = useCallback(() => {
82
- const ws = connectWebSocket({
83
- onOpen: () => {
84
- setConnectionStatus('connected')
85
- message.success('实时连接已建立')
86
- },
87
- onMessage: (data) => {
88
- // 处理实时数据更新
89
- if (data.globalStats) {
90
- setGlobalStats(data.globalStats)
91
- }
92
- if (data.workers) {
93
- const allWorkers = []
94
- Object.entries(data.workers).forEach(([queueName, queueWorkers]) => {
95
- queueWorkers.forEach(worker => {
96
- allWorkers.push({ ...worker, queue: queueName })
97
- })
98
- })
99
- setWorkers(allWorkers)
100
- }
101
- },
102
- onClose: () => {
103
- setConnectionStatus('disconnected')
104
- message.warning('实时连接已断开')
105
- },
106
- onError: () => {
107
- setConnectionStatus('error')
108
- }
109
- })
110
-
111
- wsRef.current = ws
112
- return ws
113
- }, [])
114
-
115
- // 组件挂载时初始化
116
- useEffect(() => {
117
- fetchData()
118
- const ws = setupWebSocket()
119
-
120
- // 设置定时刷新
121
- const refreshInterval = setInterval(fetchData, 30000) // 30秒刷新一次
122
-
123
- return () => {
124
- clearInterval(refreshInterval)
125
- if (ws) {
126
- ws.close()
127
- }
128
- }
129
- }, [fetchData, setupWebSocket])
130
-
131
- // 处理时间范围变化
132
- const handleTimeRangeChange = (value) => {
133
- setChartTimeRange(value)
134
- setCustomTimeRange(null)
135
- }
136
-
137
- const handleCustomTimeRangeChange = (dates) => {
138
- if (dates) {
139
- setCustomTimeRange(dates)
140
- setChartTimeRange('custom')
141
- }
142
- }
143
-
144
- // 渲染统计卡片
145
- const renderStatsCards = () => {
146
- const statsData = [
147
- {
148
- title: 'Workers',
149
- value: globalStats.online_workers,
150
- total: globalStats.total_workers,
151
- icon: <TeamOutlined />,
152
- color: '#52c41a',
153
- suffix: `/ ${globalStats.total_workers}`,
154
- trend: globalStats.online_workers > 0 ? 'up' : 'down'
155
- },
156
- {
157
- title: '活跃队列',
158
- value: globalStats.active_queues,
159
- total: globalStats.total_queues,
160
- icon: <AppstoreOutlined />,
161
- color: '#1890ff',
162
- suffix: `/ ${globalStats.total_queues}`,
163
- },
164
- {
165
- title: '运行中任务',
166
- value: globalStats.running_tasks,
167
- icon: <SyncOutlined spin />,
168
- color: '#faad14',
169
- },
170
- {
171
- title: '待处理任务',
172
- value: globalStats.pending_tasks,
173
- icon: <ClockCircleOutlined />,
174
- color: '#13c2c2',
175
- },
176
- {
177
- title: '已完成',
178
- value: globalStats.completed_tasks,
179
- icon: <CheckCircleOutlined />,
180
- color: '#52c41a',
181
- precision: 0,
182
- },
183
- {
184
- title: '失败任务',
185
- value: globalStats.failed_tasks,
186
- icon: <CloseCircleOutlined />,
187
- color: '#ff4d4f',
188
- precision: 0,
189
- },
190
- ]
191
-
192
- return statsData.map((stat, index) => (
193
- <Col xs={24} sm={12} md={8} lg={4} key={index}>
194
- <StatsCard {...stat} />
195
- </Col>
196
- ))
197
- }
198
-
199
- return (
200
- <div className="dashboard-container">
201
- <Spin spinning={loading} size="large">
202
- {/* 统计概览 */}
203
- <Row gutter={[16, 16]} className="stats-row">
204
- {renderStatsCards()}
205
- </Row>
206
-
207
- {/* 图表区域 */}
208
- <Row gutter={[16, 16]} className="charts-row">
209
- <Col xs={24} lg={16}>
210
- <Card
211
- className="chart-card"
212
- title="队列处理趋势"
213
- extra={
214
- <Space>
215
- <div className="time-range-selector">
216
- {timeRangeOptions.map(option => (
217
- <Button
218
- key={option.value}
219
- type={chartTimeRange === option.value ? 'primary' : 'text'}
220
- size="small"
221
- onClick={() => handleTimeRangeChange(option.value)}
222
- >
223
- {option.label}
224
- </Button>
225
- ))}
226
- </div>
227
- <RangePicker
228
- showTime
229
- size="small"
230
- value={customTimeRange}
231
- onChange={handleCustomTimeRangeChange}
232
- placeholder={['开始时间', '结束时间']}
233
- />
234
- </Space>
235
- }
236
- >
237
- <QueueChart
238
- queues={queues}
239
- timeRange={chartTimeRange}
240
- customTimeRange={customTimeRange}
241
- mode="trend" // 使用趋势图模式
242
- loading={loading}
243
- />
244
- </Card>
245
- </Col>
246
-
247
- <Col xs={24} lg={8}>
248
- <Card
249
- className="chart-card"
250
- title="Worker 分布"
251
- >
252
- <WorkerChart workers={workers} />
253
- </Card>
254
- </Col>
255
- </Row>
256
-
257
- {/* 队列状态表格 */}
258
- <Row gutter={[16, 16]} className="table-row">
259
- <Col span={24}>
260
- <Card
261
- className="table-card"
262
- title="队列状态"
263
- extra={
264
- <Button
265
- type="link"
266
- onClick={() => window.location.href = '/queues'}
267
- >
268
- 查看全部
269
- </Button>
270
- }
271
- >
272
- {/* 这里可以添加队列表格组件 */}
273
- </Card>
274
- </Col>
275
- </Row>
276
- </Spin>
277
- </div>
278
- )
279
- }
280
-
281
- export default Dashboard