Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
周伟奇
/
bmw-ocr
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
ff65d75c
authored
2025-01-10 15:47:29 +0800
by
冯轩
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
MOD:celery worker
1 parent
f26fe223
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
src/celery_compare/__init__.py
src/celery_compare/tasks.py
src/celery_compare/__init__.py
View file @
ff65d75
...
...
@@ -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'
)
...
...
src/celery_compare/tasks.py
View file @
ff65d75
...
...
@@ -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
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment