deployments.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:renga-python 作者: SwissDataScienceCenter 项目源码 文件源码
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')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号