26 April 2024
Zuzana
Pausing and disabling Ray execution
Let's say you have multiple Ray calls that you need to temporarily disable. You could go and comment them all out, or you could use ray()->disable()
at the top of the file (or higher up in the call stack) to temporarily disable Ray execution.
You can also check if Ray has already been disabled somewhere else in your application by running ray()->disabled()
, and you can run ray()->enable()
and ray()->enabled()
too.
Disabling and enabling Ray execution is especially useful when running tests. You don't want your Ray output to be cluttered by Ray calls when running tests, which might happen if you have Ray calls scattered throughout your application.
An easy way to deal with this situation is to disable Ray at the beginning of the test and only enable it during the arrange step of the test. You can learn more about this technique in this blog post.
What if you want to halt code execution altogether? There is a method for that! Run ray()->pause()
to pause ALL code execution, and when you are ready to move forward, you can simply press the Continue button in the output.
Understand and fix bugs faster
Ray is a desktop application that serves as the dedicated home for debugging output. Send, format and filter debug information from both local projects and remote servers.