Task.py 文件源码

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

项目:opsweb 作者: wylok 项目源码 文件源码
def del_zabbix_events():
    try:
        HOST = '172.16.4.93'
        PORT = 3306
        DB = 'zabbix'
        MYSQL = Mysql.MYSQL(USER,PASSWORD,HOST,PORT,DB)
        cmd = "select eventid from events order by eventid  limit 10000;"
        results = MYSQL.Run(cmd)
        MYSQL.Close()
        def Delete(eventid):
            MySql = Mysql.MYSQL(USER,PASSWORD,HOST,PORT,DB)
            cmd = "delete from events where eventid=%i" % int(eventid[0])
            MySql.Run(cmd)
            MySql.Close()
        pool = ThreadPool(8)
        pool.map(Delete, results)
        pool.close()
        pool.join()
        loging.write('del_last_eventid:%s' %results[-1][0])
    except Exception as e:
        loging.write(e)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号