Debug with local_mode=False

How severe does this issue affect your experience of using Ray?

  • Low: It annoys or frustrates me for a moment.

Hello everyone,
I’m trying to debug my rllib application with vscode. I’ve put some breakpoints inside the files and if I run the debugger with ray.init(local_mode=True), the program actually stop at the breakpoints and I’m able to debug.
When I set ray.init(local_mode=False), the debugger won’t stop at breakpoints but it just runs until I stop it.

  1. The fact that ray runs on multiple processes when local_mode=False is something that could give me problems or I can just build my application in local mode and then run it without the local mode?
  2. If the two modes are different, what are their main differences? and there is a way to debug in local_mode=False?

Maybe my question is trivial but it will help me a lot in my experiments to understand this.

Hey @ColdFrenzy , for distributed debugging Ray comes with pdb integration: https://docs.ray.io/en/latest/ray-observability/ray-debugging.html

This is needed since Ray is managing multiple worker processes possibly across multiple machines. The distributed debugger will allow you to use breakpoints in a similar way with Ray.

  1. The fact that ray runs on multiple processes when local_mode=False is something that could give me problems or I can just build my application in local mode and then run it without the local mode?

We recommend generally not using local mode. Usually the distributed debugger should provide a better experience (local mode was added before this was available). Most Ray users run Ray in normal mode even when developing on a laptop / single machine.

  1. If the two modes are different, what are their main differences? and there is a way to debug in local_mode=False?

In local mode, parallel execution is completely disabled, and Ray tries to run everything in a single process.

1 Like