From dd2e9f844f4e008e9ce7b88977cfb32187c7580a Mon Sep 17 00:00:00 2001 From: Cyrille Derche Date: Fri, 28 Jun 2024 17:28:48 +0200 Subject: [PATCH] handlers --- worker/tasks.py | 54 +++++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/worker/tasks.py b/worker/tasks.py index c2ba8a0..4aea89f 100644 --- a/worker/tasks.py +++ b/worker/tasks.py @@ -130,49 +130,51 @@ def ask_question_auto_search( logging.info("FINISHED JOB WITH EXCEPTION") -# @celeryd_init.connect -# def celeryd_init(sender=None, **kwargs): -# logging.info("celeryd_init start.") -# init_tracing() -# logging.info("celeryd_init end.") +@celeryd_init.connect +def celeryd_init_handler(sender=None, **kwargs): + logging.info("celeryd_init_handler start.") + init_tracing() + logging.info("celeryd_init_handler end.") -# @celeryd_after_setup.connect -# def celeryd_after_setup(sender=None, **kwargs): -# logging.info("celeryd_after_setup start.") -# init_tracing() -# logging.info("celeryd_after_setup end.") +@celeryd_after_setup.connect +def celeryd_after_setup_handler(sender=None, **kwargs): + logging.info("celeryd_after_setup_handler start.") + init_tracing() + logging.info("celeryd_after_setup_handler end.") -# @worker_init.connect -# def worker_init(sender=None, **kwargs): -# logging.info("worker_init start.") -# init_tracing() -# logging.info("worker_init end.") +@worker_init.connect +def worker_init_handler(sender=None, **kwargs): + logging.info("worker_init_handler start.") + init_tracing() + logging.info("worker_init_handler end.") -@worker_process_init.connect -def worker_process_init(sender=None, **kwargs): - logging.info("worker_process_init start.") - init_tracing() - logging.info("worker_process_init end.") +# @worker_process_init.connect +# def worker_process_init_handler(sender=None, **kwargs): +# logging.info("worker_process_init_handler start.") +# init_tracing() +# logging.info("worker_process_init_handler end.") # @worker_ready.connect -# def worker_ready(sender=None, **kwargs): -# logging.info("worker_ready start.") +# def worker_ready_handler(sender=None, **kwargs): +# logging.info("worker_ready_handler start.") # init_tracing() -# logging.info("worker_ready end.") +# logging.info("worker_ready_handler end.") # @task_prerun.connect -# def task_prerun(sender=None, **kwargs): -# logging.info("task_prerun start.") +# def task_prerun_handler(sender=None, **kwargs): +# logging.info("task_prerun_handler start.") # init_tracing() -# logging.info("task_prerun end.") +# logging.info("task_prerun_handler end.") @task_postrun.connect def task_postrun_handler(sender=None, **kwargs): + logging.info("task_postrun_handler start.") # Trigger garbage collection after each task gc.collect() + logging.info("task_postrun_handler end.")