Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#681 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
48/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
docker, python
Lĩnh vực
cli

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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
Ngôn ngữ chính
Python
Star
327
Fork
170
Merge trung bình
8 ngày 14 giờ
Pull request đã merge (30 ngày)
7

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của QuantConnect/lean-cli

Tất cả issue của QuantConnect/lean-cli

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.