コード例 #1
0
def main():
    kubernetes.config.load_incluster_config()
    cluster_config_path = prepare_ray_cluster_config()

    config = create_or_update_cluster(
        cluster_config_path,
        override_min_workers=None,
        override_max_workers=None,
        no_restart=False,
        restart_only=False,
        yes=True,
        no_config_cache=True)
    with open(cluster_config_path, "w") as file:
        yaml.dump(config, file)

    ray_head_pod_ip = get_ray_head_pod_ip(config)
    # TODO: Add support for user-specified redis port and password
    redis_address = services.address(ray_head_pod_ip,
                                     ray_constants.DEFAULT_PORT)
    stderr_file, stdout_file = get_logs()

    services.start_monitor(
        redis_address,
        stdout_file=stdout_file,
        stderr_file=stderr_file,
        autoscaling_config=cluster_config_path,
        redis_password=ray_constants.REDIS_DEFAULT_PASSWORD)
コード例 #2
0
 def start_monitor(self) -> None:
     ray_head_pod_ip = commands.get_head_node_ip(self.config_path)
     # TODO: Add support for user-specified redis port and password
     redis_address = services.address(ray_head_pod_ip,
                                      ray_constants.DEFAULT_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)
     self.mtr.run()
コード例 #3
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()