ff65d75c by 冯轩

MOD:celery worker

1 parent f26fe223
...@@ -8,4 +8,6 @@ broker = conf.CELERY_BROKER_URL ...@@ -8,4 +8,6 @@ broker = conf.CELERY_BROKER_URL
8 8
9 app = Celery('celery_compare', broker=broker, include=['celery_compare.tasks']) 9 app = Celery('celery_compare', broker=broker, include=['celery_compare.tasks'])
10 10
11 app.conf.update(worker_max_tasks_per_child=10, timezone='Asia/Shanghai') 11 # worker_max_tasks_per_child ,worker执行了几次任务就会死
12 #app.conf.update(worker_max_tasks_per_child=10, timezone='Asia/Shanghai')
13 app.conf.update(timezone='Asia/Shanghai')
......
...@@ -54,7 +54,7 @@ import threading ...@@ -54,7 +54,7 @@ import threading
54 import concurrent.futures 54 import concurrent.futures
55 from concurrent.futures import ThreadPoolExecutor 55 from concurrent.futures import ThreadPoolExecutor
56 56
57 #pool = ThreadPoolExecutor(max_workers=20, thread_name_prefix="my_thread_") 57 pool = ThreadPoolExecutor(max_workers=50, thread_name_prefix="compare_thread_")
58 58
59 compare_log = logging.getLogger('compare') 59 compare_log = logging.getLogger('compare')
60 log_base = '[Compare]' 60 log_base = '[Compare]'
...@@ -3730,9 +3730,9 @@ def fsm_compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca= ...@@ -3730,9 +3730,9 @@ def fsm_compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=
3730 # results = list(executor.map(fsm_compare_thread, application_id, application_entity, uniq_seq, ocr_res_id, is_ca, is_cms)) 3730 # results = list(executor.map(fsm_compare_thread, application_id, application_entity, uniq_seq, ocr_res_id, is_ca, is_cms))
3731 3731
3732 compare_log.info('[fsm thread]') 3732 compare_log.info('[fsm thread]')
3733 pool = ThreadPoolExecutor(max_workers=6, thread_name_prefix="fsm_thread_") 3733 #pool = ThreadPoolExecutor(max_workers=6, thread_name_prefix="fsm_thread_")
3734 pool.submit(fsm_compare_thread, application_id, application_entity, uniq_seq, ocr_res_id, is_ca, is_cms) 3734 pool.submit(fsm_compare_thread, application_id, application_entity, uniq_seq, ocr_res_id, is_ca, is_cms)
3735 pool.shutdown(wait=True) 3735 #pool.shutdown(wait=True)
3736 3736
3737 3737
3738 def fsm_compare_thread(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True, is_cms=False): 3738 def fsm_compare_thread(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True, is_cms=False):
...@@ -3808,9 +3808,9 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True ...@@ -3808,9 +3808,9 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True
3808 # results = list(executor.map(compare_thread, application_id, application_entity, uniq_seq, ocr_res_id, is_ca, is_cms)) 3808 # results = list(executor.map(compare_thread, application_id, application_entity, uniq_seq, ocr_res_id, is_ca, is_cms))
3809 3809
3810 compare_log.info('[non fsm thread]') 3810 compare_log.info('[non fsm thread]')
3811 pool = ThreadPoolExecutor(max_workers=6, thread_name_prefix="non_fsm_thread_") 3811 #pool = ThreadPoolExecutor(max_workers=6, thread_name_prefix="non_fsm_thread_")
3812 pool.submit(compare_thread, application_id, application_entity, uniq_seq, ocr_res_id, is_ca, is_cms) 3812 pool.submit(compare_thread, application_id, application_entity, uniq_seq, ocr_res_id, is_ca, is_cms)
3813 pool.shutdown(wait=True) 3813 #pool.shutdown(wait=True)
3814 3814
3815 def compare_thread(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True, is_cms=False): 3815 def compare_thread(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True, is_cms=False):
3816 # POS: application_id, application_entity, uniq_seq, None 3816 # POS: application_id, application_entity, uniq_seq, None
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!