Support debugging of indirect child processes.
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
Direzione di ricerca
Inizia esaminando gli entry point menzionati debugpy.server.cli.options, debugpy.server.api e debugpy.connect, quindi confrontali con il supporto multiprocesso esistente per i processi figli diretti. Definisci il confine ufficiale dell’API per trasferire il contesto della sessione attraverso processi indiretti non Python; il lavoro è completato quando l’albero di worker multilivello mostrato può connettersi senza dipendere dai dettagli di implementazione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Python
- Stelle
- 2.5k
- Fork
- 202
- Merge medio
- 5g 1h
- PR unite (30g)
- 1
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di microsoft/debugpy
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Document "rules"-option Apertadocumentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
-
Adapter bootstrap fails with ConnectionRefusedError on WSL2 VirtioProxy or hostAddressLoopback Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
Tutte le issue di microsoft/debugpy
Issue simili
-
area: harness bug status: needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Human-Agent-Society/reef#625 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 80/100
learningequality/kolibri#15351 · 2 commenti ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Name consistency Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
eellak/triplestore#65 · 1 commento ·