Fix flaky test_locality_aware_leasing_borrowed_objects (#24452)

The test is flaky because we schedule g task without waiting for f task to complete (because f_obj is embedded inside a list) so we may not have the locality information for f_obj from owner during g task scheduling.

Related issue number

Closes #23964
This commit is contained in:
Jiajun Yao 2022-05-04 10:12:31 -07:00 committed by GitHub
parent e00c611807
commit 6bd65ceb1c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -413,6 +413,10 @@ def test_locality_aware_leasing_borrowed_objects(ray_start_cluster):
# f will run on worker, f_obj will be pinned on worker. # f will run on worker, f_obj will be pinned on worker.
f_obj = f.options(resources={"pin_worker": 1}).remote() f_obj = f.options(resources={"pin_worker": 1}).remote()
# Make sure owner has the location information for f_obj,
# before we launch g so g worker can get the locality information
# from the owner.
ray.wait([f_obj], fetch_local=False)
# g will run on head, f_obj will be borrowed by head, and we confirm that # g will run on head, f_obj will be borrowed by head, and we confirm that
# h(f_obj) is scheduled onto worker, the node that has f_obj. # h(f_obj) is scheduled onto worker, the node that has f_obj.
assert ( assert (