Container lookup failures during result polling are masked by UnboundLocalError

オープン 初心者向け
#783 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@pcbeingused333 がすでに取り組んでいます。

2026年11月25日 から。

  • #787 @pcbeingused333 による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
80/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
docker, python
領域
cli

調査の方向性

lean/components/docker/docker_manager.py の read_from_file から始めてください。try ブロックを読み、その中で get_container_by_name と Popen が呼ばれ、次に汎用の except を読み、それは p.stderr を出力します。get_container_by_name をパッチして RuntimeError('Docker unavailable') を発生させ、read_from_file('container', Path('result.json'), interval=0.01, timeout=0.1) を呼び出すテストで再現してください。元のエラーが表面化し、既存の正常読み取りテストとリトライテストが引き続き通るようになったら完了です。

索引モデルが issue の本文から書いたものです。

説明

priority:P2

Problem

DockerManager.read_from_file dereferences p.stderr in its generic exception handler even when container lookup or Popen failed before p was assigned. A Docker connection failure is consequently replaced by UnboundLocalError.

Reproduction

On current master, mock get_container_by_name to raise RuntimeError('Docker unavailable'), then call read_from_file('container', Path('result.json'), interval=0.01, timeout=0.1).

Observed: UnboundLocalError: cannot access local variable 'p' where it is not associated with a value, rather than a diagnostic of the Docker failure. The same happens if the first process cannot be started.

The relevant exception handler is in lean/components/docker/docker_manager.py, inside read_from_file.

Required result

A failure before process creation must preserve the original diagnostic and must not fail while formatting it. Existing successful reads and retry behavior must remain intact.

主要言語
Python
スター
335
フォーク
172
平均マージ
6時間 54分
マージ済み PR(30日)
37

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

QuantConnect/lean-cli のほかの issue

QuantConnect/lean-cli の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。