try to scheduler multi tasks
This commit is contained in:
@@ -105,8 +105,8 @@ if __name__ == '__main__':
|
||||
# file_list = ['~/Desktop/contact_list_2025-07-28.xlsx']
|
||||
# file_list = ['~/Desktop/contact_list_2025-06-23.xlsx']
|
||||
# file_list = ['~/Desktop/contact_list_2025-03-11.xlsx']
|
||||
# file_list = ['~/Desktop/contact_list_2025-05-21.xlsx']
|
||||
file_list = ['~/Desktop/contact_list_2025-08-14.xlsx']
|
||||
file_list = ['~/Desktop/contact_list_2025-05-21.xlsx']
|
||||
# file_list = ['~/Desktop/contact_list_2025-08-14.xlsx']
|
||||
# file_list = ['~/Desktop/real_name_contacts_100_27_06.xlsx']
|
||||
send_request_for_file_list(file_list=file_list, thread_number=10,
|
||||
data_queue_name=MORNING_DATA_CACHE, stop_at_hour=19, stop_at_mins=50)
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
from apscheduler.executors.pool import ThreadPoolExecutor, ProcessPoolExecutor
|
||||
from apscheduler.schedulers.blocking import BlockingScheduler
|
||||
|
||||
from queue_message.CookiesPublisher import MORNING_DATA_CACHE
|
||||
from request_sender_test import send_request_for_file_list
|
||||
|
||||
|
||||
def start_book_appointment():
|
||||
file_list = ['~/Desktop/contact_list_2025-08-18.xlsx']
|
||||
send_request_for_file_list(file_list=file_list, thread_number=10,
|
||||
data_queue_name=MORNING_DATA_CACHE, stop_at_hour=14, stop_at_mins=20)
|
||||
|
||||
|
||||
def start_check_results_job(sched):
|
||||
sched.add_job(start_book_appointment, 'cron', day_of_week='mon-sat', hour='13',
|
||||
minute='00',
|
||||
misfire_grace_time=10,
|
||||
second='10', timezone='Europe/Paris', max_instances=1, args=[])
|
||||
|
||||
|
||||
def config_and_start_jobs():
|
||||
executors = {
|
||||
'default': ThreadPoolExecutor(30),
|
||||
'processpool': ProcessPoolExecutor(12)
|
||||
}
|
||||
sched = BlockingScheduler(executors=executors)
|
||||
start_check_results_job(sched)
|
||||
sched.print_jobs()
|
||||
sched.start()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
config_and_start_jobs()
|
||||
+2
-2
@@ -6,9 +6,9 @@ from request_sender_test import send_request_for_file_list
|
||||
|
||||
|
||||
def start_book_appointment():
|
||||
file_list = ['~/Desktop/contact_list_2025-07-11.xlsx']
|
||||
file_list = ['~/Desktop/contact_list_2025-08-18.xlsx']
|
||||
send_request_for_file_list(file_list=file_list, thread_number=60,
|
||||
data_queue_name=MORNING_DATA_CACHE, stop_at_hour=11, stop_at_mins=20)
|
||||
data_queue_name=MORNING_DATA_CACHE, stop_at_hour=11, stop_at_mins=10)
|
||||
|
||||
|
||||
def start_check_results_job(sched):
|
||||
|
||||
Reference in New Issue
Block a user