lockbot 2.13.0__tar.gz → 2.15.0__tar.gz
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.
- {lockbot-2.13.0/python/lockbot.egg-info → lockbot-2.15.0}/PKG-INFO +27 -46
- {lockbot-2.13.0 → lockbot-2.15.0}/README.md +26 -44
- {lockbot-2.13.0 → lockbot-2.15.0}/pyproject.toml +2 -3
- lockbot-2.15.0/python/lockbot/backend/app/agent_skill/SKILL.md +658 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/backup/service.py +13 -0
- lockbot-2.15.0/python/lockbot/backend/app/bots/datasource.py +89 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/bots/manager.py +1 -1
- lockbot-2.15.0/python/lockbot/backend/app/bots/metrics_access.py +69 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/bots/models.py +3 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/bots/router.py +37 -2
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/bots/schemas.py +11 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/main.py +25 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/managed_paths.py +1 -1
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/op_skill/SKILL.md +4 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/resource_api/commands.py +38 -7
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/resource_api/discovery.py +29 -1
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/resource_api/event_log.py +4 -1
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/resource_api/notifications.py +15 -5
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/resource_api/resources.py +10 -2
- lockbot-2.15.0/python/lockbot/backend/app/resource_api/rules.py +85 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/resource_api/skill.py +29 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/resource_api/usage.py +84 -10
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/resource_api/view_links.py +1 -1
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/resource_api/views.py +10 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/core/base_bot.py +33 -3
- lockbot-2.15.0/python/lockbot/core/bot_instance.py +50 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/core/config.py +26 -150
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/core/device_bot.py +10 -2
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/core/handler.py +2 -69
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/core/i18n/en.py +6 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/core/i18n/zh.py +6 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/core/io.py +3 -3
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/core/node_bot.py +6 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/core/platforms/infoflow.py +3 -3
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/core/queue_bot.py +47 -11
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/core/queue_device_bot.py +31 -2
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/core/request.py +2 -2
- lockbot-2.15.0/python/lockbot/core/resource_policy.py +40 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/core/scheduler.py +9 -26
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/core/utils.py +1 -1
- lockbot-2.15.0/python/lockbot/metrics/__init__.py +1 -0
- lockbot-2.15.0/python/lockbot/metrics/exporter.py +642 -0
- lockbot-2.15.0/python/lockbot/metrics/gateway.py +413 -0
- {lockbot-2.13.0 → lockbot-2.15.0/python/lockbot.egg-info}/PKG-INFO +27 -46
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot.egg-info/SOURCES.txt +7 -2
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot.egg-info/requires.txt +0 -1
- lockbot-2.13.0/python/lockbot/backend/app/agent_skill/SKILL.md +0 -397
- lockbot-2.13.0/python/lockbot/core/bot_instance.py +0 -81
- lockbot-2.13.0/python/lockbot/core/entry.py +0 -81
- lockbot-2.13.0/python/lockbot/core/env.py +0 -11
- {lockbot-2.13.0 → lockbot-2.15.0}/LICENSE +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/MANIFEST.in +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/__init__.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/__init__.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/__init__.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/admin/__init__.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/admin/router.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/audit/__init__.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/audit/models.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/audit/router.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/audit/service.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/auth/__init__.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/auth/dependencies.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/auth/models.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/auth/router.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/auth/schemas.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/backup/__init__.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/backup/router.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/backup/scheduler.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/bot_audit/__init__.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/bot_audit/models.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/bot_audit/router.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/bot_audit/service.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/bots/__init__.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/bots/encryption.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/bots/webhook_handler.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/broadcast/__init__.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/broadcast/models.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/broadcast/router.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/broadcast/service.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/config.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/database.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/deployment.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/logs/__init__.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/rate_limit.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/resource_api/__init__.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/resource_api/activity.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/resource_api/errors.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/resource_api/ingress.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/resource_api/observability.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/resource_api/op_skill.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/resource_api/operator.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/resource_api/snapshot.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/resource_api/sources.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/resource_api/traffic.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/resource_api/usage_cleanup.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/resource_api/versioning.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/resource_auth/__init__.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/resource_auth/authority.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/resource_auth/credentials.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/resource_auth/dependencies.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/resource_auth/http_errors.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/resource_auth/models.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/resource_auth/pending.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/resource_auth/router.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/resource_auth/service.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/service_traffic.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/settings/__init__.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/settings/models.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/settings/router.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/sqlite_paths.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/state_migration.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/state_ownership.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/backend/app/static.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/core/__init__.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/core/command_context.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/core/device_usage_alert.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/core/device_usage_utils.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/core/i18n/__init__.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/core/message_adapter.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/core/msg_utils.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/core/platforms/__init__.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot/core/platforms/registry.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot.egg-info/dependency_links.txt +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/python/lockbot.egg-info/top_level.txt +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/setup.cfg +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/tools/create_super_admin.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/tools/gen_keys.py +0 -0
- {lockbot-2.13.0 → lockbot-2.15.0}/tools/reset_super_admin_password.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: lockbot
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.15.0
|
|
4
4
|
Summary: Cluster resource management bot for IM platforms
|
|
5
5
|
Author-email: Jianbang Yang <yangjianbang112@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -23,7 +23,6 @@ Description-Content-Type: text/markdown
|
|
|
23
23
|
License-File: LICENSE
|
|
24
24
|
Requires-Dist: pycryptodome
|
|
25
25
|
Requires-Dist: requests
|
|
26
|
-
Requires-Dist: flask
|
|
27
26
|
Requires-Dist: six
|
|
28
27
|
Requires-Dist: fastapi
|
|
29
28
|
Requires-Dist: uvicorn[standard]
|
|
@@ -47,7 +46,7 @@ Dynamic: license-file
|
|
|
47
46
|
Cluster resource management bot for IM platforms (e.g., Baidu InfoFlow).
|
|
48
47
|
|
|
49
48
|
Lock and unlock GPU devices, cluster nodes, and queue slots via chat commands.
|
|
50
|
-
|
|
49
|
+
Runs as a multi-bot platform with FastAPI and a Vue.js frontend.
|
|
51
50
|
|
|
52
51
|
[中文文档](README_CN.md) | [Live Demo](https://dynamicheart.github.io/lockbot/)
|
|
53
52
|
|
|
@@ -128,10 +127,11 @@ docker exec -it lockbot python tools/create_super_admin.py --username admin --em
|
|
|
128
127
|
| `TOKEN` | Bot signature verification token | `""` |
|
|
129
128
|
| `AESKEY` | Message decryption AES key | `""` |
|
|
130
129
|
| `WEBHOOK_URL` | Message webhook URL | `""` |
|
|
131
|
-
| `PORT` | Server listen port | `8090` |
|
|
132
130
|
| `DEFAULT_DURATION` | Default lock duration (seconds) | `7200` (2h) |
|
|
133
131
|
| `MAX_LOCK_DURATION` | Max lock duration (seconds) | `-1` (unlimited) |
|
|
134
132
|
| `EARLY_NOTIFY` | Notify before lock expiry | `false` |
|
|
133
|
+
| `FORBID_RELOCK` | Reject renewal and longer booking claims when explicitly enabled per bot | `false` |
|
|
134
|
+
| `MAX_RESOURCES_PER_USER` | Held + booked resources per user/bot; nodes for NODE/QUEUE, cards for DEVICE/QUEUE_DEVICE | `-1` (unlimited) |
|
|
135
135
|
|
|
136
136
|
See `python/lockbot/core/config.py` for the full configuration reference.
|
|
137
137
|
|
|
@@ -178,48 +178,29 @@ ruff check python/ tests/
|
|
|
178
178
|
ruff format --check python/ tests/
|
|
179
179
|
```
|
|
180
180
|
|
|
181
|
-
##
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
**Node Lock Bot / Queue Bot** (per-node locking or queue scheduling):
|
|
207
|
-
|
|
208
|
-
```python
|
|
209
|
-
from lockbot.core.bot_instance import BotInstance
|
|
210
|
-
from lockbot.core.entry import create_app
|
|
211
|
-
|
|
212
|
-
instance = BotInstance("NODE", { # or "QUEUE" for queue scheduling
|
|
213
|
-
"BOT_NAME": "my-node-bot",
|
|
214
|
-
"WEBHOOK_URL": "https://your-webhook-url",
|
|
215
|
-
"TOKEN": "your-bot-token",
|
|
216
|
-
"AESKEY": "your-aes-key",
|
|
217
|
-
"CLUSTER_CONFIGS": ["node0", "node1", "node2", "node3"],
|
|
218
|
-
})
|
|
219
|
-
|
|
220
|
-
app = create_app(bot=instance.bot, bot_name="my-node-bot", port=8000)
|
|
221
|
-
app.run(host="0.0.0.0", port=8000)
|
|
222
|
-
```
|
|
181
|
+
## Migrating an older standalone deployment
|
|
182
|
+
|
|
183
|
+
The deprecated Flask entry (`lockbot.core.entry.create_app` / `run_bot`) and process-global
|
|
184
|
+
`Config.get/set/load_from_file/load_from_env` API have been removed. Bot construction no
|
|
185
|
+
longer starts a private scheduler. The supported deployment is the FastAPI platform above,
|
|
186
|
+
including when managing only one bot. Existing platform Docker deployments keep the same
|
|
187
|
+
startup command, ports and persistent data layout; no database reset is required.
|
|
188
|
+
|
|
189
|
+
For an old standalone deployment:
|
|
190
|
+
|
|
191
|
+
1. Keep a backup of its configuration and JSON state before stopping its old webhook server.
|
|
192
|
+
2. Start the platform, create the matching bot type, and copy its cluster, messaging
|
|
193
|
+
credentials and runtime rules into the bot editor. Do not publish credentials in logs.
|
|
194
|
+
3. Restore the saved cluster state through the platform's existing cluster-state import
|
|
195
|
+
while the bot is stopped. Verify resource names, holders, expiry and queues before start.
|
|
196
|
+
Do not copy old state over an unrelated bot's directory or remove the old data volume.
|
|
197
|
+
4. Point the messaging platform callback at `/api/bots/webhook/{bot_id}` and start the bot.
|
|
198
|
+
Keep the previous image and backup until the new callback and expiry checks work.
|
|
199
|
+
|
|
200
|
+
The core bot classes remain independently constructible for tests, with per-instance
|
|
201
|
+
`Config` objects. Platform scheduling, persisted state formats and legacy state migrations
|
|
202
|
+
remain supported. The external XPU monitoring example under `docs/examples/xpu_monitor`
|
|
203
|
+
is a separate program; its optional Flask webhook still uses its documented own dependencies.
|
|
223
204
|
|
|
224
205
|
## License
|
|
225
206
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Cluster resource management bot for IM platforms (e.g., Baidu InfoFlow).
|
|
4
4
|
|
|
5
5
|
Lock and unlock GPU devices, cluster nodes, and queue slots via chat commands.
|
|
6
|
-
|
|
6
|
+
Runs as a multi-bot platform with FastAPI and a Vue.js frontend.
|
|
7
7
|
|
|
8
8
|
[中文文档](README_CN.md) | [Live Demo](https://dynamicheart.github.io/lockbot/)
|
|
9
9
|
|
|
@@ -84,10 +84,11 @@ docker exec -it lockbot python tools/create_super_admin.py --username admin --em
|
|
|
84
84
|
| `TOKEN` | Bot signature verification token | `""` |
|
|
85
85
|
| `AESKEY` | Message decryption AES key | `""` |
|
|
86
86
|
| `WEBHOOK_URL` | Message webhook URL | `""` |
|
|
87
|
-
| `PORT` | Server listen port | `8090` |
|
|
88
87
|
| `DEFAULT_DURATION` | Default lock duration (seconds) | `7200` (2h) |
|
|
89
88
|
| `MAX_LOCK_DURATION` | Max lock duration (seconds) | `-1` (unlimited) |
|
|
90
89
|
| `EARLY_NOTIFY` | Notify before lock expiry | `false` |
|
|
90
|
+
| `FORBID_RELOCK` | Reject renewal and longer booking claims when explicitly enabled per bot | `false` |
|
|
91
|
+
| `MAX_RESOURCES_PER_USER` | Held + booked resources per user/bot; nodes for NODE/QUEUE, cards for DEVICE/QUEUE_DEVICE | `-1` (unlimited) |
|
|
91
92
|
|
|
92
93
|
See `python/lockbot/core/config.py` for the full configuration reference.
|
|
93
94
|
|
|
@@ -134,48 +135,29 @@ ruff check python/ tests/
|
|
|
134
135
|
ruff format --check python/ tests/
|
|
135
136
|
```
|
|
136
137
|
|
|
137
|
-
##
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
**Node Lock Bot / Queue Bot** (per-node locking or queue scheduling):
|
|
163
|
-
|
|
164
|
-
```python
|
|
165
|
-
from lockbot.core.bot_instance import BotInstance
|
|
166
|
-
from lockbot.core.entry import create_app
|
|
167
|
-
|
|
168
|
-
instance = BotInstance("NODE", { # or "QUEUE" for queue scheduling
|
|
169
|
-
"BOT_NAME": "my-node-bot",
|
|
170
|
-
"WEBHOOK_URL": "https://your-webhook-url",
|
|
171
|
-
"TOKEN": "your-bot-token",
|
|
172
|
-
"AESKEY": "your-aes-key",
|
|
173
|
-
"CLUSTER_CONFIGS": ["node0", "node1", "node2", "node3"],
|
|
174
|
-
})
|
|
175
|
-
|
|
176
|
-
app = create_app(bot=instance.bot, bot_name="my-node-bot", port=8000)
|
|
177
|
-
app.run(host="0.0.0.0", port=8000)
|
|
178
|
-
```
|
|
138
|
+
## Migrating an older standalone deployment
|
|
139
|
+
|
|
140
|
+
The deprecated Flask entry (`lockbot.core.entry.create_app` / `run_bot`) and process-global
|
|
141
|
+
`Config.get/set/load_from_file/load_from_env` API have been removed. Bot construction no
|
|
142
|
+
longer starts a private scheduler. The supported deployment is the FastAPI platform above,
|
|
143
|
+
including when managing only one bot. Existing platform Docker deployments keep the same
|
|
144
|
+
startup command, ports and persistent data layout; no database reset is required.
|
|
145
|
+
|
|
146
|
+
For an old standalone deployment:
|
|
147
|
+
|
|
148
|
+
1. Keep a backup of its configuration and JSON state before stopping its old webhook server.
|
|
149
|
+
2. Start the platform, create the matching bot type, and copy its cluster, messaging
|
|
150
|
+
credentials and runtime rules into the bot editor. Do not publish credentials in logs.
|
|
151
|
+
3. Restore the saved cluster state through the platform's existing cluster-state import
|
|
152
|
+
while the bot is stopped. Verify resource names, holders, expiry and queues before start.
|
|
153
|
+
Do not copy old state over an unrelated bot's directory or remove the old data volume.
|
|
154
|
+
4. Point the messaging platform callback at `/api/bots/webhook/{bot_id}` and start the bot.
|
|
155
|
+
Keep the previous image and backup until the new callback and expiry checks work.
|
|
156
|
+
|
|
157
|
+
The core bot classes remain independently constructible for tests, with per-instance
|
|
158
|
+
`Config` objects. Platform scheduling, persisted state formats and legacy state migrations
|
|
159
|
+
remain supported. The external XPU monitoring example under `docs/examples/xpu_monitor`
|
|
160
|
+
is a separate program; its optional Flask webhook still uses its documented own dependencies.
|
|
179
161
|
|
|
180
162
|
## License
|
|
181
163
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "lockbot"
|
|
7
|
-
version = "2.
|
|
7
|
+
version = "2.15.0"
|
|
8
8
|
description = "Cluster resource management bot for IM platforms"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = {text = "MIT"}
|
|
@@ -27,10 +27,9 @@ classifiers = [
|
|
|
27
27
|
]
|
|
28
28
|
|
|
29
29
|
dependencies = [
|
|
30
|
-
# Core
|
|
30
|
+
# Core
|
|
31
31
|
"pycryptodome",
|
|
32
32
|
"requests",
|
|
33
|
-
"flask",
|
|
34
33
|
"six",
|
|
35
34
|
# Backend (platform mode)
|
|
36
35
|
"fastapi",
|