Merge branch 'feature/CHINARPA-5155' into feature/uat-tmp
Showing
1 changed file
with
17 additions
and
6 deletions
| ... | @@ -53,6 +53,9 @@ from common.tools.aes_util import aes_decrypt_cbc | ... | @@ -53,6 +53,9 @@ from common.tools.aes_util import aes_decrypt_cbc |
| 53 | 53 | ||
| 54 | import threading | 54 | import threading |
| 55 | import concurrent.futures | 55 | import concurrent.futures |
| 56 | from concurrent.futures import ThreadPoolExecutor | ||
| 57 | |||
| 58 | pool = ThreadPoolExecutor(max_workers=20, thread_name_prefix="my_thread_") | ||
| 56 | 59 | ||
| 57 | compare_log = logging.getLogger('compare') | 60 | compare_log = logging.getLogger('compare') |
| 58 | log_base = '[Compare]' | 61 | log_base = '[Compare]' |
| ... | @@ -3723,9 +3726,13 @@ def fsm_compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca= | ... | @@ -3723,9 +3726,13 @@ def fsm_compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca= |
| 3723 | # producer_thread_fsm.start() | 3726 | # producer_thread_fsm.start() |
| 3724 | # except Exception as e: | 3727 | # except Exception as e: |
| 3725 | # compare_log.info('[fsm thread error] [error={0}]'.format(traceback.format_exc())) | 3728 | # compare_log.info('[fsm thread error] [error={0}]'.format(traceback.format_exc())) |
| 3726 | with concurrent.futures.ThreadPoolExecutor(max_workers=20) as executor: | 3729 | |
| 3727 | # 使用map函数提交多个任务 | 3730 | # with concurrent.futures.ThreadPoolExecutor(max_workers=20) as executor: |
| 3728 | results = list(executor.map(fsm_compare_thread, application_id, application_entity, uniq_seq, ocr_res_id, is_ca, is_cms)) | 3731 | # # 使用map函数提交多个任务 |
| 3732 | # results = list(executor.map(fsm_compare_thread, application_id, application_entity, uniq_seq, ocr_res_id, is_ca, is_cms)) | ||
| 3733 | |||
| 3734 | compare_log.info('[fsm thread]') | ||
| 3735 | pool.submit(fsm_compare_thread, application_id, application_entity, uniq_seq, ocr_res_id, is_ca, is_cms) | ||
| 3729 | 3736 | ||
| 3730 | 3737 | ||
| 3731 | 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): |
| ... | @@ -3795,9 +3802,13 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True | ... | @@ -3795,9 +3802,13 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True |
| 3795 | # producer_thread.start() | 3802 | # producer_thread.start() |
| 3796 | # except Exception as e: | 3803 | # except Exception as e: |
| 3797 | # compare_log.info('[thread error] [error={0}]'.format(traceback.format_exc())) | 3804 | # compare_log.info('[thread error] [error={0}]'.format(traceback.format_exc())) |
| 3798 | with concurrent.futures.ThreadPoolExecutor(max_workers=20) as executor: | 3805 | |
| 3799 | # 使用map函数提交多个任务 | 3806 | # with concurrent.futures.ThreadPoolExecutor(max_workers=20) as executor: |
| 3800 | results = list(executor.map(compare_thread, application_id, application_entity, uniq_seq, ocr_res_id, is_ca, is_cms)) | 3807 | # # 使用map函数提交多个任务 |
| 3808 | # results = list(executor.map(compare_thread, application_id, application_entity, uniq_seq, ocr_res_id, is_ca, is_cms)) | ||
| 3809 | |||
| 3810 | compare_log.info('[non fsm thread]') | ||
| 3811 | pool.submit(compare_thread, application_id, application_entity, uniq_seq, ocr_res_id, is_ca, is_cms) | ||
| 3801 | 3812 | ||
| 3802 | def compare_thread(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True, is_cms=False): | 3813 | def compare_thread(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True, is_cms=False): |
| 3803 | # POS: application_id, application_entity, uniq_seq, None | 3814 | # POS: application_id, application_entity, uniq_seq, None | ... | ... |
-
Please register or sign in to post a comment