run_one_injection.py 文件源码

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

项目:sassifi 作者: NVlabs 项目源码 文件源码
def is_timeout(app, pr): # check if the process is active every 'factor' sec for timeout threshold 
    factor = 0.25
    retcode = None
    tt = cp.TIMEOUT_THRESHOLD * sp.apps[app][2] # sp.apps[app][2] = expected runtime
    if tt < 10: tt = 10

    to_th = tt / factor
    while to_th > 0:
        retcode = pr.poll()
        if retcode is not None:
            break
        to_th -= 1
        time.sleep(factor)

    if to_th == 0:
        os.killpg(pr.pid, signal.SIGKILL) # pr.kill()
        print "timeout"
        return [True, pr.poll()]
    else:
        return [False, retcode]

###############################################################################
# Run the actual injection run 
###############################################################################
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号