Skip to content

My Dagster code is hanging or taking longer than I expect to execute. How can I troubleshoot? #14771

Discussion options

You must be logged in to vote

We recommend that you use py-spy to profile your code.

For hanging code, py-spy dump can give you a dump of each thread, which usually makes it immediately clear where the hang is happening.

For slow code, py-spy record can produce file that gives you a flame graph of where the process is spending the most time. (We recommend py-spy record -f speedscope --idle to produce speedscope profiles, and to include idle CPU time in the results)

Note that py-spy usually requires elevated permissions in order to run.

For example, to run py-spy locally and understand why definitions are taking a long time to import:

sudo py-spy record -f speedscope --idle -- dagster definitions validate

--

A typical…

Replies: 4 comments 8 replies

Comment options

gibsondan
Jun 13, 2023
Maintainer Author

You must be logged in to vote
2 replies
@abi-mutinex
Comment options

@babaMar
Comment options

Answer selected by gibsondan
Comment options

You must be logged in to vote
1 reply
@gibsondan
Comment options

gibsondan Jun 16, 2023
Maintainer Author

Comment options

You must be logged in to vote
5 replies
@gibsondan
Comment options

gibsondan Oct 28, 2024
Maintainer Author

@gibsondan
Comment options

gibsondan Oct 28, 2024
Maintainer Author

@yamhirotoCS
Comment options

@gibsondan
Comment options

gibsondan Oct 28, 2024
Maintainer Author

@yamhirotoCS
Comment options

Comment options

gibsondan
Jan 31, 2025
Maintainer Author

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: troubleshooting Related to debugging and error messages
5 participants