Replies: 1 comment 1 reply
-
This is currently possible, but off the backend instead: from django_tasks import default_task_backend
default_task_backend.get_result(...) Alternatively, you can do it from the task: from tasks import my_task
my_task.get_result(...) The latter doing an internal check to make sure the result is for the correct It's only mentioned in passing in the DEP (see the interfaces for task and backend), but it's absolutely a required feature I agree. Shortcuts is an interesting idea, but I suspect it's less useful as the ORM counterparts. The result ID is generally only useful internally, so 404-ing when the result is missing is rarely the right way to go. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Reading the DEP, I can't see an API clearly defined to retrieve a task using its id.
Indeed:
E.G:
Let's say I start a background task from an AJAX request, and now I do long polling from the client to know the task status. On a WSGI app, I don't know what process I'll end up with, so I can't cache the task result object on the backend, I can only keep the task ID on the frontend.
I need a way to say something like:
As well as the shortcuts like get_object_or_404, but for a task.
Beta Was this translation helpful? Give feedback.
All reactions