def test_operator_infer_port(self):
     stop_cmd = "ray stop"
     start_cmd = "ulimit -n 65536; ray start --head --no-monitor"\
         " --dashboard-host 0.0.0.0 --port 1234567"
     cluster_config = {"head_start_ray_commands": [stop_cmd, start_cmd]}
     assert infer_head_port(cluster_config) == "1234567"
     # Use equals sign.
     start_cmd = "ulimit -n 65536; ray start --head --no-monitor"\
         " --dashboard-host 0.0.0.0 --port=1234567"
     cluster_config = {"head_start_ray_commands": [stop_cmd, start_cmd]}
     assert infer_head_port(cluster_config) == "1234567"
     # Don't specify port
     start_cmd = "ulimit -n 65536; ray start --head --no-monitor"\
         " --dashboard-host 0.0.0.0"
     cluster_config = {"head_start_ray_commands": [stop_cmd, start_cmd]}
     assert infer_head_port(cluster_config) == str(DEFAULT_PORT)
Exemple #2
0
 def start_monitor(self) -> None:
     ray_head_pod_ip = commands.get_head_node_ip(self.config_path)
     port = operator_utils.infer_head_port(self.config)
     redis_address = services.address(ray_head_pod_ip, port)
     self.mtr = monitor.Monitor(
         redis_address=redis_address,
         autoscaling_config=self.config_path,
         redis_password=ray_constants.REDIS_DEFAULT_PASSWORD,
         prefix_cluster_info=True,
         stop_event=self.monitor_stop_event)
     self.mtr.run()