设置时间限制,等待任务结束

设置时间限制,等待任务结束

import time

print('start task and wait')

waitflag = 0
timeline = 10

while True:
    time.sleep(60)
    print('check process and get result')
    task_reslut = True

    if task_reslut:
        waitflag += 1
    else:
        waitflag = 0

    if waitflag >= timeline:
        print('task end success')
        break
posted @ 2021-10-24 10:15  疯狂列表推导式  阅读(38)  评论(0编辑  收藏  举报