helpers.py 文件源码

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

项目:sat6_scripts 作者: RedHatSatellite 项目源码 文件源码
def wait_for_task(task_id, label):
    """
    Wait for the given task ID to complete
    This displays a message without CR/LF waiting for an OK/FAIL status to be shown
    """
    msg = "  Waiting for " + label + " to complete..."
    colx = "{:<70}".format(msg)
    print colx[:70],
    log_msg(msg, 'INFO')
    # Force the status message to be shown to the user
    sys.stdout.flush()
    while True:
        info = get_json(FOREMAN_API + "tasks/" + str(task_id))
        if info['state'] == 'paused' and info['result'] == 'error':
            msg = "Error with " + label + " " + str(task_id)
            log_msg(msg, 'ERROR')
            break
        if info['pending'] != 1:
            break
        sleep(30)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号