sdk icon indicating copy to clipboard operation
sdk copied to clipboard

docs: Debugging Targets PDB Documentation

Open visch opened this issue 3 years ago • 2 comments

Feature scope

Targets (data type handling, batching, SQL object generation, etc.)

Description

Not sure if we want to make changes to the SDK but I wanted to document this somewhere publicly.

How to debug a Target written with the SDK.

  • Why

Debugging is a bit tougher with targets for two reasons

  1. Targets use STDIN and PDB does the same
  2. Targets use joblib.Parallel to Parallelize each sink see https://joblib.readthedocs.io/en/latest/generated/joblib.Parallel.html
  • How
  1. Add the remote-pdb dependency, poetry add remote-pdb
  2. Override max_parallelism in your target.py to only use 1 parallel job (ie no parallelization is used at all). ie
@property
def max_parallelism(self) -> int:
    return 1                  
  1. export PYTHONBREAKPOINT=remote_pdb.set_trace , export REMOTE_PDB_QUIET=1 so no output from remote-pdb gets sent to the target export REMOTE_PDB_HOST=127.0.0.1 , export REMOTE_PDB_PORT=4444 ,
  2. Run the target like normal, and in a seperate terminal run telnet 127.0.0.1 4444
  3. Note that you can use breakpoint() to set a breakpoint
  4. Remember that if you're using Meltano you'll have to reinstall (even if you're using -e) as this is a new dependency

These commands are tweakable read through the documentation here https://pypi.org/project/remote-pdb/

visch avatar Aug 15 '22 17:08 visch

This has been marked as stale because it is unassigned, and has not had recent activity. It will be closed after 21 days if no further activity occurs. If this should never go stale, please add the evergreen label, or request that it be added.

stale[bot] avatar Jul 18 '23 06:07 stale[bot]

This has been marked as stale because it is unassigned, and has not had recent activity. It will be closed after 21 days if no further activity occurs. If this should never go stale, please add the evergreen label, or request that it be added.

stale[bot] avatar Jul 19 '24 20:07 stale[bot]