Allow start_ray.sh to take an object manager port. (#272)

* Allow start_ray.sh to take a object manager port.

* Fix typo and add test.

* Small cleanups.
This commit is contained in:
Robert Nishihara
2017-02-12 12:39:32 -08:00
committed by Philipp Moritz
parent 7bf80b6b22
commit f6ce9dfa6c
4 changed files with 95 additions and 13 deletions
+11 -4
View File
@@ -11,6 +11,7 @@ parser = argparse.ArgumentParser(description="Parse addresses for the worker to
parser.add_argument("--node-ip-address", required=False, type=str, help="the IP address of the worker's node")
parser.add_argument("--redis-address", required=False, type=str, help="the address to use for connecting to Redis")
parser.add_argument("--redis-port", required=False, type=str, help="the port to use for starting Redis")
parser.add_argument("--object-manager-port", required=False, type=int, help="the port to use for starting the object manager")
parser.add_argument("--num-workers", default=10, required=False, type=int, help="the number of workers to start on this node")
parser.add_argument("--head", action="store_true", help="provide this argument for the head node")
@@ -50,10 +51,15 @@ if __name__ == "__main__":
node_ip_address = args.node_ip_address
print("Using IP address {} for this node.".format(node_ip_address))
address_info = {}
# Use the provided Redis port if there is one.
if args.redis_port is not None:
address_info = {"redis_address": "{}:{}".format(node_ip_address,
args.redis_port)}
else:
address_info["redis_address"] = "{}:{}".format(node_ip_address,
args.redis_port)
# Use the provided object manager port if there is one.
if args.object_manager_port is not None:
address_info["object_manager_ports"] = [args.object_manager_port]
if address_info == {}:
address_info = None
address_info = services.start_ray_head(address_info=address_info,
@@ -91,7 +97,7 @@ if __name__ == "__main__":
if args.node_ip_address is None:
node_ip_address = services.get_node_ip_address(args.redis_address)
else:
node_ip_addess = args.node_ip_address
node_ip_address = args.node_ip_address
print("Using IP address {} for this node.".format(node_ip_address))
# Check that there aren't already Redis clients with the same IP address
# connected with this Redis instance. This raises an exception if the Redis
@@ -99,6 +105,7 @@ if __name__ == "__main__":
check_no_existing_redis_clients(node_ip_address, args.redis_address)
address_info = services.start_ray_node(node_ip_address=node_ip_address,
redis_address=args.redis_address,
object_manager_ports=[args.object_manager_port],
num_workers=args.num_workers,
cleanup=False,
redirect_output=True)