How does everyone debug and step through their dag...
# ask-community
c
How does everyone debug and step through their dagster code? I am using vs code and have a few assets in this script. I want to debug on the fly though. Any examples on this?
c
Huge, thanks.
d
You can use ForkedPDB provided by Dagster and insert breakpoints in your code. I’m pretty sure it works even if you launch stuff from Dagit. You can also execute the code with the dagster CLI command.
z
@Daniel Gafni can you provide a link for ForkedPDB? Is it this one? https://github.com/Lightning-AI/forked-pdb
I'm extremely interested in this as well
d
c
@asset(
required_resource_keys={"sql", "queries"}
)
def member_scores(context) -> pd.DataFrame:
cnxn = context.resources.sql['sql']
ForkedPdb().set_trace()
cnxn.connect()
score_sql = context.resources.queries['person_scores']
df = cnxn.query(score_sql)
cnxn.close()
return df
I run dagster dev in my code location and when I try to materialize in the dagit UI, the code just fails. How exactly do I get into debugging mode? Here's the example from the docs.