Skip to content

Commit 5544552

Browse files
authored
[Autoscaler] Update CoordinatorNodeProvider example (#51293)
Signed-off-by: Dongjun Na <kmu5544616@gmail.com>
1 parent 22f1f70 commit 5544552

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

python/ray/autoscaler/_private/local/coordinator_node_provider.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def _get_http_response(self, request):
4444
"Could not connect to: "
4545
+ http_coordinator_address
4646
+ ". Did you run python coordinator_server.py"
47-
+ " --ips <list_of_node_ips> --port <PORT>?"
47+
+ " --ips <list_of_node_ips> --host <HOST> --port <PORT>?"
4848
)
4949
raise
5050
except ImportError:

python/ray/autoscaler/local/coordinator_server.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
different clusters for multiple users. It receives node provider function calls
33
through HTTP requests from remote CoordinatorSenderNodeProvider and runs them
44
locally in LocalNodeProvider. To start the webserver the user runs:
5-
`python coordinator_server.py --ips <comma separated ips> --port <PORT>`."""
5+
`python coordinator_server.py --ips <comma separated ips> --host <HOST> --port <PORT>`."""
66
import argparse
77
import json
88
import logging
9-
import socket
109
import threading
10+
import socket
1111
from http.server import HTTPServer, SimpleHTTPRequestHandler
1212

1313
from ray.autoscaler._private.local.node_provider import LocalNodeProvider
@@ -105,17 +105,24 @@ def main():
105105
parser.add_argument(
106106
"--ips", required=True, help="Comma separated list of node ips."
107107
)
108+
parser.add_argument(
109+
"--host",
110+
type=str,
111+
required=False,
112+
help="The Host on which the coordinator listens.",
113+
)
108114
parser.add_argument(
109115
"--port",
110116
type=int,
111117
required=True,
112118
help="The port on which the coordinator listens.",
113119
)
114120
args = parser.parse_args()
121+
host = args.host or socket.gethostbyname(socket.gethostname())
115122
list_of_node_ips = args.ips.split(",")
116123
OnPremCoordinatorServer(
117124
list_of_node_ips=list_of_node_ips,
118-
host=socket.gethostbyname(socket.gethostname()),
125+
host=host,
119126
port=args.port,
120127
)
121128

python/ray/autoscaler/local/example-minimal-automatic.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Minimal configuration for an automatically managed on-premise cluster.
22

33
# To use, run the script at ray/python/ray/autoscaler/local/coordinator_server.py:
4-
# $ python coordinator_server.py --ips <list_of_node_ips> --port <PORT>
4+
# $ python coordinator_server.py --ips <list_of_node_ips> --host <HOST> --port <PORT>
55
# Copy the address from the output into the coordinator_address field.
66

77
# A unique identifier for the head node and workers of this cluster.

0 commit comments

Comments
 (0)