Skip to content
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

Debugger does not connect to subprocess in flows when running on Windows #16104

Open
aviadr1 opened this issue Nov 25, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@aviadr1
Copy link

aviadr1 commented Nov 25, 2024

Bug summary

When debugging flows in Prefect on Windows, it is impossible to set breakpoints inside flows. The debugger does not connect to the subprocesses spawned by the flow execution. This behavior occurs with both VSCode and PyCharm, making it difficult to debug flow-related code.


Steps to Reproduce

A minimal reproducible example:

from prefect import flow

@flow
def my_flow():
    print("Starting flow execution...")  # put your pycharm/vscode breakpoint here, but it will never hit it on windows pycharm/vscode

    return "Done!"

if __name__ == "__main__":
    my_flow()
  1. Run the code with a debugger attached (VSCode or PyCharm).
  2. Attempt to hit the breakpoint() inside the flow.

Expected behavior

The debugger should connect to the subprocess, allowing breakpoints to be hit for debugging.


Actual behavior

The debugger does not connect to the flow subprocess, and breakpoints are skipped. Debugging inside flows is impossible.

Version info

Version:             3.0.10
API version:         0.8.4
Python version:      3.11.7
Git commit:          3aa2d893
Built:               Tue, Oct 15, 2024 1:31 PM
OS/Arch:             win32/AMD64
Profile:             local
Server type:         server
Pydantic version:    2.9.2

Additional context

This issue seems to be related to how Prefect spawns subprocesses on Windows, as debugging works fine for regular Python scripts. Debugging flows in Prefect on other operating systems (e.g., Linux) does not encounter the same issue.

This limitation severely impacts the development workflow for Windows users, especially for debugging complex flows.

Thank you for investigating this issue!

@aviadr1 aviadr1 added the bug Something isn't working label Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant