python - celery: get function name by task id? -


i using celery on_failure handler logging failed tasks debugging , analysis. , want know task name(function name) of failed task, how can that?

from celery import task  class debugtask(task):     abstract = true      def after_return(self, *args, **kwargs):         print('task returned: {0!r}'.format(self.request))      def on_failure(self, exc, task_id, args, kwargs, einfo):         func_name = get_func_name_by_task_id(task_id) # how do this?         print "{} failed".format(func_name)           # expected out: add failed.  @app.task(base=debugtask) def add(x, y):     return x + y 

ps: know there task_id, query function name task_id every time not fun,

quick @ documentation shows task.name.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -