Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

link_error in send_task not working as documented #9034

Open
4 tasks done
andreynovikov opened this issue May 20, 2024 · 0 comments
Open
4 tasks done

link_error in send_task not working as documented #9034

andreynovikov opened this issue May 20, 2024 · 0 comments

Comments

@andreynovikov
Copy link

andreynovikov commented May 20, 2024

Checklist

  • I have checked the issues list
    for similar or identical bug reports.
  • I have checked the pull requests list
    for existing proposed fixes.
  • I have checked the commit log
    to find out if the bug was already fixed in the main branch.
  • I have included all related issues and possible duplicate issues in this issue
    (If there are none, check this box anyway).

Related Issues and Possible Duplicates

Related Issues

  • None

Possible Duplicates

  • None

Description

Error handler, as it is described in https://docs.celeryq.dev/en/stable/userguide/calling.html#linking-callbacks-errbacks does not work for the following code:

headers = {...}
link = signature(process_step_result, options={'headers': headers})
link_error = signature(process_step_error, options={'headers': headers})
app.send_task(step.action.task, link=link, link_error=link_error, headers=headers)

When I use error function signature as proposed in documentation I get:

TypeError: process_step_error() missing 2 required positional arguments: 'exc' and 'traceback'

When I switch to older variant:

@app.task
def process_step_error(task_id):
    result = app.AsyncResult(task_id)
    result.get(propagate=False)

I get Never call result.get() within a task error meaning that is is NOT called directly, as also stated in documentation.

When I add allow_join_result:

@app.task
def process_step_error(task_id):
    with allow_join_result():
        result = app.AsyncResult(task_id)
        result.get(propagate=False)

I can reach the result

I use:
Celery v5.4.0
Python 3.12
Redis as transport and results database

Suggestions

Either support for link_error in send_task should be documented separately or implementation fixed.

@Nusnus Nusnus self-assigned this May 20, 2024
@Nusnus Nusnus added this to the 5.5 milestone May 20, 2024
@Nusnus Nusnus removed their assignment Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants