fix test_global_state_api due to the temporary object (#8800)

* fix test_global_state_api due to the temporary object

* update

* Update python/ray/tests/test_advanced_3.py

Co-authored-by: Robert Nishihara <robertnishihara@gmail.com>

Co-authored-by: Robert Nishihara <robertnishihara@gmail.com>
This commit is contained in:
Kai Yang
2020-06-09 11:42:40 +08:00
committed by GitHub
parent 31a4d07bc4
commit db5cc5c8da
+8 -1
View File
@@ -126,7 +126,14 @@ def test_global_state_api(shutdown_only):
assert ray.cluster_resources()["GPU"] == 3
assert ray.cluster_resources()["CustomResource"] == 1
assert ray.objects() == {}
# A driver/worker creates a temporary object during startup. Although the
# temporary object is freed immediately, in a rare case, we can still find
# the object ID in GCS because Raylet removes the object ID from GCS
# asynchronously.
# Because we can't control when workers create the temporary objects, so
# We can't assert that `ray.objects()` returns an empty dict. Here we just
# make sure `ray.objects()` succeeds.
assert len(ray.objects()) >= 0
job_id = ray.utils.compute_job_id_from_driver(
ray.WorkerID(ray.worker.global_worker.worker_id))