0
我对此 get_waiter(waiter_name)
感兴趣。服务员的例子在这page。我到处寻找,但我找不到这个特定服务的服务员的完整列表(对于Python和PHP)。AWS SDK | Elastic Beanstalk的服务员名单
基本上,我想要发生的是获得应用程序或环境的状态,并验证它是好的,然后再转到下一个任务。
我的当前方法是使用while
循环,如果AWS响应的状态与我期望的状态匹配,则使用break
。我认为这不是解决这个问题的最好方法。如果我错了,请纠正我。
下面是从我的代码用Python编写的代码片段:
# Check the application status
while True:
try:
response = eb.describe_application_versions(
ApplicationName=app_name,
VersionLabels=[
new_app_version
]
)
status = 'PROCESSED'
app_status = response['ApplicationVersions'][0]['Status']
if status == app_status:
print('Application Status:\t', app_status)
break
except:
raise
# Deploy the app to Elastic Beanstalk
try:
response = eb.update_environment(
ApplicationName=app_name,
EnvironmentId=env_id,
VersionLabel=new_app_version
)
except:
raise
# Check environment health
while True:
try:
response = eb.describe_environment_health(
EnvironmentId=env_id,
AttributeNames=[
'Status'
]
)
status = 'Ready'
env_status = response['Status']
if status == env_status:
print('Environment Status:\t', env_status)
break
except:
raise