定時任務BlockingScheduler


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()



免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM