Container lookup failures during result polling are masked by UnboundLocalError

未關閉 適合新手
#783 0 則留言 0 個 reaction 已指派 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 分鐘
30 天內合併 PR
37

環境準備

這個專案沒有提供開發容器、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 摘要。