Skip to content

Retry chain: how to get if signature of previously run task was immutable? #8658

Closed Answered by WilliamDEdwards
WilliamDEdwards asked this question in Q&A
Discussion options

You must be logged in to vote

Even with result_extended, whether a signature was mutable or immutable is not stored. This makes sense, because Celery stores results, not signatures (or even tasks in a more abstract sense).

Therefore, I have decided to store this piece of information in a local database, and reconstruct the signature as follows:

signature = celery.signature(
    result.name,
    immutable=task.internal_metadata["immutable"],
    args=result.args,
    kwargs=result.kwargs,
).set(task_id=task.uuid)

where result is an instance of celery.AsyncResult, and task is a local database object

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by WilliamDEdwards
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant