db_connect_sh_ver_w_threads.py 文件源码

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

项目:Network-Automation-with-Python-and-Ansible-class 作者: pmusolino-rms 项目源码 文件源码
def main():
    django.setup()

    devices = NetworkDevice.objects.all()
    starttime = datetime.now()
    for dev in devices:
        my_thread = threading.Thread(target=show_version, args=(dev,))
        my_thread.start()

    main_thread = threading.currentThread()

    for thread in threading.enumerate():
        if thread != main_thread:
            print thread
            thread.join()

    totaltime = datetime.now() - starttime
    print
    print "Elapsed time " + str(totaltime)
    print
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号