如何使用 AWS Boto3 查找 ECS 服务的所需计数、剩余计数

问题描述 投票:0回答:1

我可以使用下面的方法找到正在运行的任务,但无法弄清楚如何找出所需的计数和剩余计数,如果您可以帮助,请告诉我,谢谢

tasks = client.list_tasks(cluster=cluster, serviceName=serviceName)
running_tasks = len(tasks['taskArns'])
python amazon-web-services boto3 amazon-ecs aws-fargate
1个回答
0
投票

用途:

desiredCount = client.describe_services(cluster=cluster, services = [serviceName])['services'][0]['desiredCount']

runningCount = client.describe_services(cluster=cluster, services = [serviceName])['services'][0]['runningCount']
© www.soinside.com 2019 - 2024. All rights reserved.