You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be very useful for django-tasks to support a built-in task caching mechanism to allow developers to track the progress and store metadata of running tasks. This is particularly helpful for long-running tasks where the client needs to poll for updates or retrieve the result later.
We've implemented a simple version of this using a TaskCache model and utility functions to associate a task with a cache entry, update its progress, and retrieve results.
Example Use Case
# Create a cache entry before enqueuingcache_id=init_task_cache()
result=some_long_task.enqueue(args, cache_id)
bind_task_cache(cache_id, result.id)
# Inside the task@task()defsome_long_task(args, cache_id=None):
set_task_cache(cache_id, "progress", 0)
# do some work...set_task_cache(cache_id, "progress", 50)
# more work...set_task_cache(cache_id, "progress", 100)
Description
It would be very useful for
django-tasks
to support a built-in task caching mechanism to allow developers to track the progress and store metadata of running tasks. This is particularly helpful for long-running tasks where the client needs to poll for updates or retrieve the result later.We've implemented a simple version of this using a
TaskCache
model and utility functions to associate a task with a cache entry, update its progress, and retrieve results.Example Use Case
Example Implementation
Benefits
Proposal
Add optional support to django-tasks for task-level caching. This could include:
The text was updated successfully, but these errors were encountered: