-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Replace ptvsd with debugpy to match modern VS Code #7110
base: master
Are you sure you want to change the base?
Conversation
ee69b3c
to
a539f84
Compare
@gaecoli @wlach @eradman @lucydodo How are you doing interactive debugging of Redash these days? I'm trying this Haven't tried it for debugging a worker process yet though. My suspicion is we'll need to add some extra code for that, though I'm not 100% sure. My initial thought for that is perhaps something like this in an appropriate class (TBD) in something common to all the workers:
Note the different port ( Thoughts? |
I have not used remote Python debugging, so I'll defer to others on this. |
No worries Eric. What's the approach you're using for debugging? Starting the individual processes locally then? |
me toooooo. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order debug a handler I had to use VSCode + debugpy, and found that it worked nicely!
To add a breakpoint I had to import debugpy
in the module I was trying to trace
index 0a7b6749..bfdfb07a 100644
--- a/redash/handlers/query_results.py
+++ b/redash/handlers/query_results.py
@@ -36,6 +36,8 @@ from redash.utils import (
to_filename,
)
+import debugpy
+
def error_response(message, http_status=400):
return {"job": {"status": 4, "error": message}}, http_status
@@ -329,6 +331,7 @@ class QueryResultResource(BaseResource):
if query_result:
+ debugpy.breakpoint()
require_access(query_result.data_source, self.current_user, view_only)
Then restart the server using
docker compose stop server && docker compose run --rm --service-ports server debug
This is valuable; @justinclift I'd say go ahead and rebase this change
Thanks @eradman, I'll get to this in a few hours when I get to the co-working space. 😄 |
So much for "in a few hours". I'll get to this probably Tuesday instead. 😬 |
What type of PR is this?
Description
VS Code has moved to using debugpy for debugging rather than the old (archived) ptvsd.
This (very simple) PR updates our code to use debugpy now too.
NOTE - This PR is a work in progress. 😄
How is this tested?
Related Tickets & Documents
Useful reference info: https://github.com/microsoft/debugpy/wiki/Switching-over-from-%60ptvsd%60-to-%60debugpy%60
Redash documentation that will need updating: https://redash.io/help/open-source/dev-guide/debugging/ (source)
Mobile & Desktop Screenshots/Recordings (if there are UI changes)