ray-project / ray

Ray is an AI compute engine. Ray consists of a core distributed runtime and a set of AI Libraries for accelerating ML workloads.
https://ray.io
Apache License 2.0
34.12k stars 5.79k forks source link

[Debugger] Ray debugger interrupts with my normal flow of debugging #48728

Open kouroshHakha opened 1 week ago

kouroshHakha commented 1 week ago

What happened + What you expected to happen

When i run the repro code on ray 2.39 I get the message 2024-11-13 12:11:46,137 INFO debugpy.py:92 -- Waiting for debugger to attach (see https://docs.ray.io/en/latest/ray-observability/ray-distributed-debugger.html)...

but in 2.38 this wasn't the case, and I could interactively debug.

Please note that I have put the breakpoint on the driver and not inside the tasks / actors, so I don't really need distributed debugging here.

Versions / Dependencies

ray==2.39 doesn't work ray==2.38 works

Reproduction script


import ray

def main():
    ds = ray.data.from_items(
        [
            {
                "input": "David",
                "expected": "Hi David",
            },
        ]
    )
    breakpoint()

if __name__ == "__main__":
    main()

Issue Severity

High: It blocks me from completing my task.

pcmoritz commented 1 week ago

Thanks for reporting, you can restore the previous behavior by setting RAY_DEBUG=legacy

pcmoritz commented 1 week ago

I could see people who run a driver in an interactive shell wanting to use PDB directly in it. We could detect that and invoke PDB by default (if stdin is connected, which will be the case e.g. if you run in a shell). I'm not a huge fan of the inconsistency but good UX triumphs consistency sometime, what do you think @kouroshHakha ?

kouroshHakha commented 1 week ago

yeah I think that's a reasonable. And if there is a flag to control this behavior by selecting pdb vs. debugpy is a good compromise.