Skip to content
This repository was archived by the owner on Jan 12, 2026. It is now read-only.

Commit d415b49

Browse files
authored
Remove calls to deprecated Ray core APIs (#293)
1 parent c41de94 commit d415b49

File tree

5 files changed

+15
-12
lines changed

5 files changed

+15
-12
lines changed

requirements/test-requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ dask
1010
#workaround for now
1111
protobuf<4.0.0
1212
tensorboardX==2.2
13+
aiohttp

xgboost_ray/data_sources/dask.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def get_ip_to_parts(data: Any) -> Dict[int, Sequence[Any]]:
144144
# (though Ray tries to keep locality). We need to use that until
145145
# ray.state.objects() or something like it is available again.
146146
partition_locations_df = persisted.map_partitions(
147-
lambda df: pd.DataFrame([ray.get_runtime_context().node_id.hex()])
147+
lambda df: pd.DataFrame([ray.get_runtime_context().get_node_id()])
148148
).compute()
149149
partition_locations = [
150150
partition_locations_df[0].iloc[i] for i in range(partition_locations_df.size)

xgboost_ray/tests/conftest.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
def get_default_fixure_system_config():
1515
system_config = {
1616
"object_timeout_milliseconds": 200,
17-
"num_heartbeats_timeout": 10,
18-
"object_store_full_max_retries": 3,
19-
"object_store_full_initial_delay_ms": 100,
17+
"health_check_initial_delay_ms": 0,
18+
"health_check_failure_threshold": 10,
19+
"object_store_full_delay_ms": 100,
2020
}
2121
return system_config
2222

@@ -26,6 +26,8 @@ def get_default_fixture_ray_kwargs():
2626
ray_kwargs = {
2727
"num_cpus": 1,
2828
"object_store_memory": 150 * 1024 * 1024,
29+
"dashboard_port": None,
30+
"namespace": "default_test_namespace",
2931
"_system_config": system_config,
3032
}
3133
return ray_kwargs

xgboost_ray/tests/test_colocation.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616

1717
class _MockQueueActor(_QueueActor):
1818
def get_node_id(self):
19-
return ray.state.current_node_id()
19+
return ray.get_runtime_context().get_node_id()
2020

2121

2222
class _MockEventActor(_EventActor):
2323
def get_node_id(self):
24-
return ray.state.current_node_id()
24+
return ray.get_runtime_context().get_node_id()
2525

2626

2727
@pytest.mark.usefixtures("ray_start_cluster")
@@ -71,20 +71,20 @@ def test_communication_colocation(self):
7171
cluster.wait_for_nodes()
7272
ray.init(address=cluster.address)
7373

74-
local_node = ray.state.current_node_id()
74+
local_node = ray.get_runtime_context().get_node_id()
7575

7676
# Note that these will have the same IP in the test cluster
77-
assert len(ray.state.node_ids()) == 2
78-
assert local_node in ray.state.node_ids()
77+
assert len(ray.nodes()) == 2
78+
assert local_node in [node["NodeID"] for node in ray.nodes()]
7979

8080
def _mock_train(*args, _training_state, **kwargs):
8181
assert (
8282
ray.get(_training_state.queue.actor.get_node_id.remote())
83-
== ray.state.current_node_id()
83+
== ray.get_runtime_context().get_node_id()
8484
)
8585
assert (
8686
ray.get(_training_state.stop_event.actor.get_node_id.remote())
87-
== ray.state.current_node_id()
87+
== ray.get_runtime_context().get_node_id()
8888
)
8989
return _train(*args, _training_state=_training_state, **kwargs)
9090

xgboost_ray/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def get_current_node_resource_key() -> str:
8585
If using Ray Client, this will return the resource key for the node that
8686
is running the client server.
8787
"""
88-
current_node_id = ray.get_runtime_context().node_id.hex()
88+
current_node_id = ray.get_runtime_context().get_node_id()
8989
for node in ray.nodes():
9090
if node["NodeID"] == current_node_id:
9191
# Found the node.

0 commit comments

Comments
 (0)