mirror of
https://github.com/wassname/ray.git
synced 2026-07-08 11:58:22 +08:00
Better checking that ray.init() has been called. (#10261)
This commit is contained in:
@@ -123,21 +123,6 @@ def wait_for_num_objects(num_objects, timeout=10):
|
||||
|
||||
def test_global_state_api(shutdown_only):
|
||||
|
||||
error_message = ("The ray global state API cannot be used "
|
||||
"before ray.init has been called.")
|
||||
|
||||
with pytest.raises(Exception, match=error_message):
|
||||
ray.objects()
|
||||
|
||||
with pytest.raises(Exception, match=error_message):
|
||||
ray.actors()
|
||||
|
||||
with pytest.raises(Exception, match=error_message):
|
||||
ray.nodes()
|
||||
|
||||
with pytest.raises(Exception, match=error_message):
|
||||
ray.jobs()
|
||||
|
||||
ray.init(num_cpus=5, num_gpus=3, resources={"CustomResource": 1})
|
||||
|
||||
assert ray.cluster_resources()["CPU"] == 5
|
||||
@@ -462,15 +447,6 @@ def test_non_ascii_comment(ray_start_regular):
|
||||
assert ray.get(f.remote()) == 1
|
||||
|
||||
|
||||
def test_shutdown_disconnect_global_state():
|
||||
ray.init(num_cpus=0)
|
||||
ray.shutdown()
|
||||
|
||||
with pytest.raises(Exception) as e:
|
||||
ray.objects()
|
||||
assert str(e.value).endswith("ray.init has been called.")
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"ray_start_object_store_memory", [150 * 1024 * 1024], indirect=True)
|
||||
def test_put_pins_object(ray_start_object_store_memory):
|
||||
|
||||
Reference in New Issue
Block a user