def stop_executions(config, context_id, endpoint, all_contexts):
"""Stop running executions."""
client = from_config(config, endpoint=endpoint)
if not bool(context_id) ^ all_contexts:
raise click.UsageError(
'Either specify context id or use --all-contexts')
if context_id:
contexts = (client.contexts[cid] for cid in context_id)
else:
contexts = client.contexts
for context in contexts:
for execution in context.executions:
try:
click.echo(
'Stopping execution {0.id} on context {1.id} ... '.format(
execution, context),
nl=False)
execution.stop()
click.secho('OK', fg='green')
except errors.APIError:
click.secho('FAIL', fg='red')
deployments.py 文件源码
python
阅读 20
收藏 0
点赞 0
评论 0
评论列表
文章目录