mirror of
https://github.com/vale981/ray
synced 2025-03-06 10:31:39 -05:00
Fix bug when connecting another driver in local case. (#1760)
* Allow connecting another driver when using ip address 127.0.0.1. * Add test.
This commit is contained in:
parent
5c7ef34b05
commit
c6ad71fc9d
2 changed files with 23 additions and 1 deletions
|
@ -1174,7 +1174,10 @@ def get_address_info_from_redis_helper(redis_address, node_ip_address):
|
|||
assert b"ray_client_id" in info
|
||||
assert b"node_ip_address" in info
|
||||
assert b"client_type" in info
|
||||
if info[b"node_ip_address"].decode("ascii") == node_ip_address:
|
||||
client_node_ip_address = info[b"node_ip_address"].decode("ascii")
|
||||
if (client_node_ip_address == node_ip_address or
|
||||
(client_node_ip_address == "127.0.0.1" and
|
||||
redis_ip_address == ray.services.get_node_ip_address())):
|
||||
if info[b"client_type"].decode("ascii") == "plasma_manager":
|
||||
plasma_managers.append(info)
|
||||
elif info[b"client_type"].decode("ascii") == "local_scheduler":
|
||||
|
|
|
@ -283,5 +283,24 @@ class StartRayScriptTest(unittest.TestCase):
|
|||
subprocess.Popen(["ray", "stop"]).wait()
|
||||
|
||||
|
||||
class MiscellaneousTest(unittest.TestCase):
|
||||
def tearDown(self):
|
||||
ray.worker.cleanup()
|
||||
|
||||
def testConnectingInLocalCase(self):
|
||||
address_info = ray.init(num_cpus=0)
|
||||
|
||||
# Define a driver that just connects to Redis.
|
||||
driver_script = """
|
||||
import ray
|
||||
ray.init(redis_address="{}")
|
||||
print("success")
|
||||
""".format(address_info["redis_address"])
|
||||
|
||||
out = run_string_as_driver(driver_script)
|
||||
# Make sure the other driver succeeded.
|
||||
self.assertIn("success", out)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main(verbosity=2)
|
||||
|
|
Loading…
Add table
Reference in a new issue