xuekailun 5 tháng trước cách đây
mục cha
commit
d6ee0d1b8e
1 tập tin đã thay đổi với 6 bổ sung6 xóa
  1. 6 6
      longvideoapi/longvideoapi_scaling_k_count.py

+ 6 - 6
longvideoapi/longvideoapi_scaling_k_count.py

@@ -14,17 +14,17 @@ from concurrent.futures import ThreadPoolExecutor
 health_instances = []
 
 
-def longvideo_health_check(client, instance_id, max_wait_time=None):
+def longvideo_health_check(ecs_client, instance_id, max_wait_time=None):
     """
     服务健康检查
-    :param client: 客户端连接
+    :param ecs_client: 客户端连接
     :param instance_id: instanceId
     :param max_wait_time: 最长等待时间,单位:s
     :return:
     """
     global health_instances
     start_time = time.time()
-    ip_address = utils.get_ip_address(client=client, instance_id=instance_id)
+    ip_address = utils.get_ip_address(ecs_client=ecs_client, instance_id=instance_id)
     while True:
         health_check_url = f"http://{ip_address}:8080/longvideoapi/test"
         try:
@@ -60,19 +60,19 @@ async def ess_instance(ecs_client, alb_client, ess_count, max_workers):
     # 1. 购买机器并启动
     ess_instance_ids = utils.create_multiple_instances(
         amount=ess_count,
-        client=ecs_client,
+        ecs_client=ecs_client,
         **longvideoapi_config.instance_config_k,
     )
     time.sleep(60)
 
     # 2. 发送启动脚本到机器上
-    utils.send_file_to_ecs(client=ecs_client, instance_id_list=ess_instance_ids, **longvideoapi_config.start_sh)
+    utils.send_file_to_ecs(ecs_client=ecs_client, instance_id_list=ess_instance_ids, **longvideoapi_config.start_sh)
     logging.info(f"send start shell file finished, instances: {ess_instance_ids}")
     # 3. 启动服务
     start_sh_param = "latest"
     server_start_sh = os.path.join(longvideoapi_config.start_sh['target_dir'], longvideoapi_config.start_sh['name'])
     server_start_commend = f"sh {server_start_sh} {start_sh_param}"
-    utils.run_command(client=ecs_client, instance_ids=ess_instance_ids, command=server_start_commend)
+    utils.run_command(ecs_client=ecs_client, instance_ids=ess_instance_ids, command=server_start_commend)
     # 4. 异步探活
     global health_instances
     health_instances = []