Skip to content

Commit

Permalink
handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
cyri113 committed Jun 28, 2024
1 parent 0974900 commit dd2e9f8
Showing 1 changed file with 28 additions and 26 deletions.
54 changes: 28 additions & 26 deletions worker/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")

0 comments on commit dd2e9f8

Please sign in to comment.