One - One Code All

Blog Content

定时任务BLOCKINGSCHEDULER,多进程pool.map

Python   2015-09-09 21:17:12
def task():

    current_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
    print(current_time)
    coordinate_list = Getlnglat().spyder_list_all()
    pool = ThreadPool(10)  # 创建线程池并发执行
    #第一个参数是函数,第二个参数是一个迭代器,将迭代器中的数字作为参数依次传入函数中
    pool.map(crontab_task, coordinate_list)
    pool.close()


if __name__ == '__main__':
    
    sched = BlockingScheduler()
    sched.add_job(task, 'interval', hours=6)
    sched.start()



上一篇:pycurl的基础用法
下一篇:量化入门书籍推荐

The minute you think of giving up, think of the reason why you held on so long.