“Debugging ray.data”

1. Severity of the issue: (select one)

Medium: Significantly affects my productivity but can find a workaround.

2. Environment:

  • Ray version:
  • Python version:
  • OS:
  • Cloud/Infrastructure:
  • Other libs/tools (if relevant):

3. What happened vs. what you expected:

  • Expected:
  • Actual:

“I’m studying parts of Ray’s source code. Since ray.data uses lazy execution, when I debug Ray locally, I can’t get the code to run into Ray’s internal logic. This makes it impossible for me to trace the data flow during execution. How do you usually debug and study Ray in this situation?”

To debug and study Ray’s internal logic, especially with lazy execution in ray.data, you should trigger execution by materializing the dataset (e.g., by iterating over it or calling methods like .take(), .show(), or .materialize()). This forces Ray to execute the computation graph, allowing you to step into internal logic and trace data flow. You can also insert print statements or use the Ray distributed debugger by adding breakpoint() in your functions, then attach with VS Code or use the Ray Debugger for interactive inspection. For more details, see Ray Debugging Guide and Ray Data Exception Handling.

Would you like a step-by-step example of how to set up breakpoints and trigger execution for debugging?

Sources:

Hint: Mention @RunLLM in the post for followups.