Support debugging of indirect child processes.
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
Bắt đầu bằng việc xem xét các entry point được đề cập là debugpy.server.cli.options, debugpy.server.api và debugpy.connect, sau đó so sánh chúng với khả năng hỗ trợ multiprocess hiện có cho các tiến trình con trực tiếp. Xác định ranh giới API chính thức để truyền ngữ cảnh phiên qua các tiến trình gián tiếp không phải Python; được coi là hoàn thành khi cây worker nhiều cấp được minh họa có thể kết nối mà không dựa vào các chi tiết triển khai.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Python
- Star
- 2.5k
- Fork
- 202
- Merge trung bình
- 5 ngày 1 giờ
- Pull request đã merge (30 ngày)
- 1
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/debugpy
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Document "rules"-option Đang mởdocumentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
-
Adapter bootstrap fails with ConnectionRefusedError on WSL2 VirtioProxy or hostAddressLoopback Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
Tất cả issue của microsoft/debugpy
Issue tương tự
-
[Bug] reef-hermes tells me to resume with hermes --resume, which does not work from my shell Đang mởarea: harness bug status: needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Human-Agent-Society/reef#625 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 80/100
learningequality/kolibri#15351 · 2 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Name consistency Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
eellak/triplestore#65 · 1 bình luận ·