-
Notifications
You must be signed in to change notification settings - Fork 221
Description
Celery tasks have a property called shadow_name that helps identify task execution in logs, as executions typically share the same task names.
After running a Celery task, we can monitor the execution with the TaskResult object. However, when there are multiple executions of the same task that differ only by their arguments, identification becomes challenging.
Would it be feasible to add a shadow_name property to the TaskResult model and enable filtering through Django admin? Alternatively, we could prioritize the shadow name as the task_name if it has been defined.
Shadow name example:
def shadow_name(task, args, kwargs, options):
return f"sleep_{args[0]}_seconds"
@shared_task(name='sleep-example', shadow_name=shadow_name)
def sleep_example(seconds):
sleep(seconds)After running sleep_example.delay(15), we can see:
Celery documentation:
https://docs.celeryq.dev/en/stable/reference/celery.app.task.html#celery.app.task.Task.shadow_name




