MCPcopy
hub / github.com/666ghj/BettaFish / start_system

Function start_system

app.py:1241–1265  ·  view source on GitHub ↗

在接收到请求后启动完整系统。

()

Source from the content-addressed store, hash-verified

1239
1240@app.route('/api/system/start', methods=['POST'])
1241def start_system():
1242 """在接收到请求后启动完整系统。"""
1243 allowed, message = _prepare_system_start()
1244 if not allowed:
1245 return jsonify({'success': False, 'message': message}), 400
1246
1247 try:
1248 success, logs, errors = initialize_system_components()
1249 if success:
1250 _set_system_state(started=True)
1251 return jsonify({'success': True, 'message': '系统启动成功', 'logs': logs})
1252
1253 _set_system_state(started=False)
1254 return jsonify({
1255 'success': False,
1256 'message': '系统启动失败',
1257 'logs': logs,
1258 'errors': errors
1259 }), 500
1260 except Exception as exc: # pragma: no cover - 保底捕获
1261 logger.exception("系统启动过程中出现异常")
1262 _set_system_state(started=False)
1263 return jsonify({'success': False, 'message': f'系统启动异常: {exc}'}), 500
1264 finally:
1265 _set_system_state(starting=False)
1266
1267@app.route('/api/system/shutdown', methods=['POST'])
1268def shutdown_system():

Callers

nothing calls this directly

Calls 3

_prepare_system_startFunction · 0.85
_set_system_stateFunction · 0.85

Tested by

no test coverage detected