MCPcopy Create free account
hub / github.com/ComfyWorkflows/ComfyUI-Launcher / stop_project

Function stop_project

server/server.py:319–340  ·  view source on GitHub ↗
(id)

Source from the content-addressed store, hash-verified

317
318@app.route("/api/projects/<id>/stop", methods=["POST"])
319def stop_project(id):
320 project_path = os.path.join(PROJECTS_DIR, id)
321 assert os.path.exists(project_path), f"Project with id {id} does not exist"
322
323 launcher_state, _ = get_launcher_state(project_path)
324 assert launcher_state
325
326 assert launcher_state["state"] == "running", f"Project with id {id} is not running"
327
328 # kill the process with the pid
329 try:
330 pid = launcher_state["pid"]
331 parent_pid = pid
332 parent = psutil.Process(parent_pid)
333 for child in parent.children(recursive=True):
334 child.terminate()
335 parent.terminate()
336 except:
337 pass
338
339 set_launcher_state_data(project_path, {"state": "ready", "status_message" : "Ready", "port": None, "pid": None})
340 return jsonify({"success": True})
341
342
343@app.route("/api/projects/<id>/delete", methods=["POST"])

Callers 1

delete_projectFunction · 0.85

Calls 2

get_launcher_stateFunction · 0.90
set_launcher_state_dataFunction · 0.90

Tested by

no test coverage detected