Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

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

Ouverte
#681 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
48/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
docker, python
Domaine
cli

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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
Langage dominant
Python
Étoiles
327
Forks
170
Merge moyen
8 j 14 h
PR mergées (30 j)
7

Préparer son environnement

Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de QuantConnect/lean-cli

Toutes les issues de QuantConnect/lean-cli

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.