Support debugging of indirect child processes.
まだ誰も着手していません。
評価
調査の方向性
まず、言及されているエントリポイント debugpy.server.cli.options、debugpy.server.api、debugpy.connect を確認し、既存の直接の子プロセスに対するマルチプロセス対応と比較します。間接的な非 Python プロセスを介してセッションコンテキストを引き渡すための公式な API 境界を定義します。示されている多段階のワーカーツリーが実装の詳細に依存せず接続できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
While debugpy natively supports multiprocess debugging, this works only for directly launched child processes.
Sometimes, though, there may be several levels on non-Python processes between the main process and the child one needs to debug. I am hitting this limitation while trying to debug a user-defined function, that runs in the context of a PySpark worker process. The process tree looks like this:
<python process hosting my main program>
└ <pyspark process>
└ <yet another pyspark process>
├ <python worker process hosting the UDFs>
├ <python worker process hosting the UDFs>
├ ...
└ <python worker process hosting the UDFs>
After spelunking the innards of debugpy for a few hours, I've managed to come up with this code:
import pickle
import os
import debugpy
def capture_session_context():
"""To be called in the main process to capture context of the current debugpy session."""
options = debugpy.server.cli.options
context = pickle.dumps((options.address, options.adapter_access_token, os.getpid()), 0)
os.environ["DEBUGPY_CONTEXT"] = context.decode('ascii')
def connect_to_session():
"""To be called in a worker process to connect to the parent session."""
context = os.environ['DEBUGPY_CONTEXT'].encode('ascii')
address, token, ppid = pickle.loads(context)
from debugpy.server import api
api.pydevd.SetupHolder.setup = {"ppid": ppid}
debugpy.connect(address, access_token=token)
Obviously, this hack uses a bunch of implementation details. It would be nice if this scenario was officially supported.
(I mean exposing official APIs similar to the above, not that debugpy should support PySperk specifically.
- 主要言語
- Python
- スター
- 2.5k
- フォーク
- 202
- 平均マージ
- 5日 1時間
- マージ済み PR(30日)
- 1
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/debugpy のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
microsoft/debugpy の issue をすべて見る
似ている issue
-
area: harness bug status: needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
Human-Agent-Society/reef#625 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 80/100
learningequality/kolibri#15351 · コメント 2 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
Name consistency オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
eellak/triplestore#65 · コメント 1 件 ·