Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

Local live deployment keeps running after SIGTERM and can be deployed twice

未關閉
#681 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
48/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
docker, python
領域
cli

研究方向

Start with lean/components/docker/docker_manager.py around DockerManager.run_image and its existing signal_handler; check how lean live deploy builds Docker run options and whether deployment lookup already exists. Reproduce termination with the commands in the issue, then verify that supported signals stop the container and repeated deployment of the same project is refused or warned about. The issue proposes separating the signal fix from labeling and duplicate checks, whose deploy-flow approach still needs confirmation.

由索引模型根據 Issue 內容生成。

描述

Expected Behavior

When the lean process running a local (non-detached) lean live deploy is terminated, the LEAN container stops too, as it does on Ctrl+C. Starting a second local live deployment of a project whose deployment is still running is refused, or at least warned about.

Actual Behavior
  • DockerManager.run_image registers a handler for SIGINT only (lean/components/docker/docker_manager.py:242), and the container always runs detached. On SIGTERM or SIGHUP (closed SSH session, systemctl stop, timeout, a cancelled CI job or k8s pod) the CLI exits with 143 and the container keeps trading. Reproduced with Docker 29 on Linux.
  • lean live deploy does not look for a running container of the same project. Containers get a random lean_cli_<uuid> name, so a restart (for example a systemd unit with Restart=always, or simply running the command again after the above) starts a second algorithm on the same brokerage account.
Potential Solution
  1. Route SIGTERM and SIGHUP (where available) through the existing signal_handler, so they stop the container like Ctrl+C.
  2. Label LEAN containers with the project path or id, the environment and the brokerage (labels in run_options).
  3. In live deploy, look up running containers with the same project label and refuse with a clear message, offering lean live stop <project> or a --force flag.

Step 1 is small and I can open it as a PR first. Steps 2 and 3 change the deploy flow, so I'd like to confirm the approach before writing them.

Reproducing the Problem
lean live deploy MyProject --brokerage "Paper Trading" ... &
kill -TERM $!
docker ps --filter name=lean_cli_   # the container is still running
lean live deploy MyProject --brokerage "Paper Trading" ...   # a second container starts
System Information

lean-cli master at b4d724c, Python 3.12, Linux, Docker 29.

Checklist
  • I have completely filled out this template
  • I have confirmed that this issue exists on the current master branch
  • I have confirmed that this is not a duplicate issue by searching issues
主要語言
Python
星號
327
分支
170
平均合併
8 天 14 小時
30 天內合併 PR
7

環境準備

這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

QuantConnect/lean-cli 的其他 Issue

查看 QuantConnect/lean-cli 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。