This documentation is for an older version (1.4.7) of Dagster. You can view the version of this page from our latest release below.
import pdb
import sys
# From https://stackoverflow.com/questions/4716533/how-to-attach-debugger-to-a-python-subproccess
[docs]class ForkedPdb(pdb.Pdb):
"""A pdb subclass that may be used from a forked multiprocessing child.
**Examples**:
.. code-block:: python
from dagster._utils.forked_pdb import ForkedPdb
@solid
def complex_solid(_):
# some complicated stuff
ForkedPdb().set_trace()
# some other complicated stuff
You can initiate pipeline execution via the webserver and use the pdb debugger to examine/step through
execution at the breakpoint.
"""
def interaction(self, frame, traceback):
_stdin = sys.stdin
try:
sys.stdin = open("/dev/stdin", encoding="utf8")
pdb.Pdb.interaction(self, frame, traceback)
finally:
sys.stdin = _stdin