ff65d75c by 冯轩

MOD:celery worker

1 parent f26fe223
......@@ -8,4 +8,6 @@ broker = conf.CELERY_BROKER_URL
app = Celery('celery_compare', broker=broker, include=['celery_compare.tasks'])
app.conf.update(worker_max_tasks_per_child=10, timezone='Asia/Shanghai')
# worker_max_tasks_per_child ,worker执行了几次任务就会死
#app.conf.update(worker_max_tasks_per_child=10, timezone='Asia/Shanghai')
app.conf.update(timezone='Asia/Shanghai')
......
......@@ -54,7 +54,7 @@ import threading
import concurrent.futures
from concurrent.futures import ThreadPoolExecutor
#pool = ThreadPoolExecutor(max_workers=20, thread_name_prefix="my_thread_")
pool = ThreadPoolExecutor(max_workers=50, thread_name_prefix="compare_thread_")
compare_log = logging.getLogger('compare')
log_base = '[Compare]'
......@@ -3730,9 +3730,9 @@ def fsm_compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=
# results = list(executor.map(fsm_compare_thread, application_id, application_entity, uniq_seq, ocr_res_id, is_ca, is_cms))
compare_log.info('[fsm thread]')
pool = ThreadPoolExecutor(max_workers=6, thread_name_prefix="fsm_thread_")
#pool = ThreadPoolExecutor(max_workers=6, thread_name_prefix="fsm_thread_")
pool.submit(fsm_compare_thread, application_id, application_entity, uniq_seq, ocr_res_id, is_ca, is_cms)
pool.shutdown(wait=True)
#pool.shutdown(wait=True)
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
# results = list(executor.map(compare_thread, application_id, application_entity, uniq_seq, ocr_res_id, is_ca, is_cms))
compare_log.info('[non fsm thread]')
pool = ThreadPoolExecutor(max_workers=6, thread_name_prefix="non_fsm_thread_")
#pool = ThreadPoolExecutor(max_workers=6, thread_name_prefix="non_fsm_thread_")
pool.submit(compare_thread, application_id, application_entity, uniq_seq, ocr_res_id, is_ca, is_cms)
pool.shutdown(wait=True)
#pool.shutdown(wait=True)
def compare_thread(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True, is_cms=False):
# 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!