mirror of
https://github.com/vale981/ray
synced 2025-03-06 10:31:39 -05:00
[Client] disable auto init for get_runtime_context() (#19127)
This commit is contained in:
parent
86cbe3e833
commit
fe413c3c5e
2 changed files with 9 additions and 1 deletions
|
@ -189,7 +189,7 @@ _runtime_context = None
|
|||
|
||||
|
||||
@PublicAPI(stability="beta")
|
||||
@client_mode_hook(auto_init=True)
|
||||
@client_mode_hook(auto_init=False)
|
||||
def get_runtime_context():
|
||||
"""Get the runtime context of the current driver/worker.
|
||||
|
||||
|
|
|
@ -220,6 +220,14 @@ def test_actor_stats_async_actor(ray_start_regular):
|
|||
assert max(result["AysncActor.func"]["pending"] for result in results) == 3
|
||||
|
||||
|
||||
# get_runtime_context() can be called outside of Ray so it should not start
|
||||
# Ray automatically.
|
||||
def test_no_auto_init(shutdown_only):
|
||||
assert not ray.is_initialized()
|
||||
ray.get_runtime_context()
|
||||
assert not ray.is_initialized()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import pytest
|
||||
sys.exit(pytest.main(["-v", __file__]))
|
||||
|
|
Loading…
Add table
Reference in a new issue