
Security News
High Salaries No Longer Enough to Attract Top Cybersecurity Talent
A survey of 500 cybersecurity pros reveals high pay isn't enough—lack of growth and flexibility is driving attrition and risking organizational security.
.. image:: https://img.shields.io/pypi/v/django-user-tasks.svg :target: https://pypi.python.org/pypi/django-user-tasks/ :alt: PyPI
.. image:: https://github.com/openedx/django-user-tasks/workflows/Python%20CI/badge.svg?branch=master :target: https://github.com/openedx/django-user-tasks/actions?query=workflow%3A%22Python+CI%22 :alt: CI
.. image:: http://codecov.io/github/edx/django-user-tasks/coverage.svg?branch=master :target: http://codecov.io/github/edx/django-user-tasks?branch=master :alt: Codecov
.. image:: https://readthedocs.org/projects/django-user-tasks/badge/?version=latest :target: http://django-user-tasks.readthedocs.io/en/latest/ :alt: Documentation
.. image:: https://img.shields.io/pypi/pyversions/django-user-tasks.svg :target: https://pypi.python.org/pypi/django-user-tasks/ :alt: Supported Python versions
.. image:: https://img.shields.io/github/license/edx/django-user-tasks.svg :target: https://github.com/openedx/django-user-tasks/blob/master/LICENSE.txt :alt: License
django-user-tasks is a reusable Django application for managing user-triggered asynchronous tasks. It provides a status page for each such task, which includes a meaningful progress indicator if the task is currently being executed and provides any appropriate text and/or links for output once the task is complete.
In Open edX, such tasks include operations such as exporting or importing a
course, sending an email to all the students in a course, uploading a video,
and other tasks which often take too long to perform during a single web
request (as outlined in OEP-3
_). However, this has been written with the
intention of being useful in a variety of Django projects outside the Open edX
platform as well.
Note that this library was created as a consolidation of lessons learned from implementing such tasks in various parts of the Open edX code base. They don't yet all use this library, but the plan is to over time refactor many of them to do so.
.. _OEP-3: https://open-edx-proposals.readthedocs.io/en/latest/oeps/oep-0003.html
django-user-tasks is currently a wrapper for Celery
_ (although the hope is
that it could also be extended to also support channels
_ and other
asynchronous task queues). By extending the provided UserTask
class (or
adding UserTaskMixin
to an existing Task subclass) and providing a
user_id
task argument, the task's status is stored in a database table
separate from the Celery broker and result store. This UserTaskStatus
model allows for full database queries of the tasks that users are most likely
to care about while not imposing any restrictions on the Celery configuration
most appropriate for the site's overall needs for asynchronous task
processing.
Most of the status updating is handled automatically via Celery's signals
_
mechanism, but it can be enhanced by:
UserTaskMixin
methods such as generate_name
and
calculate_total_steps
for particular types of tasksUserTaskStatus
methods like
increment_completed_steps
and set_state
from the task implementationUserTaskArtifact
model.. _Celery: http://www.celeryproject.org/ .. _channels: https://channels.readthedocs.io/en/latest/ .. _signals: http://docs.celeryproject.org/en/latest/userguide/signals.html
The full documentation is at https://django-user-tasks.readthedocs.org.
The code in this repository is licensed under the Apache Software License 2.0 unless otherwise noted.
Please see LICENSE.txt
for details.
Contributions are very welcome.
Please read How To Contribute <https://github.com/openedx/.github/blob/master/CONTRIBUTING.md>
_ for details.
Please do not report security issues in public. Please email security@openedx.org.
Have a question about this repository, or about Open edX in general? Please
refer to this list of resources
_ if you need any assistance.
.. _list of resources: https://open.edx.org/getting-help
.. All enhancements and patches to django-user-tasks will be documented in this file. It adheres to the structure of http://keepachangelog.com/ , but in reStructuredText instead of Markdown (for ease of incorporation into Sphinx documentation and the PyPI description).
This project adheres to Semantic Versioning (http://semver.org/).
.. There should always be an "Unreleased" section for changes pending release.
Unreleased
[3.3.0] - 2025-02-13
Removed +++++++
python 3.8
supportpython 3.11
env[3.2.0] - 2024-03-12
Added
+++++
* Adding python 3.11 support.
* Adding python 3.12 support.
* Removed django32 support.
[3.1.0] - 2023-07-21
Added +++++
Removed +++++++
Chore +++++
edx-sphinx-theme
to sphinx-book-theme
since the former is
deprecated[3.0.0] - 2022-02-09
Removed
+++++++
* Removed Python 3.5 support.
Chore
+++++
* Upgraded celery to latest 5.x version.
[2.2.0] - 2022-01-26
Removed +++++++
Added +++++
[2.1.0] - 2021-07-07
Added
+++++
* Support for django3.0, 3.1 and 3.2
[2.0.3] - 2021-06-08
Changed +++++++
[2.0.2] - 2021-05-28
Changed
+++++++
* Fixed minor issue. If links key is not available assign empty list. Added logs.
[2.0.1] - 2021-05-28
Added +++++++
[2.0.0] - 2021-01-20
Removed
+++++++
* Removed python3.5 support.
[1.3.2] - 2020-12-17
Changed +++++++
[1.3.2] - 2020-12-17
Changed
+++++++
* Updated the deprecated celery import class. New import is compatible with 4.4.7 also.
[1.3.1] - 2020-11-23
Added +++++
[1.3.0] - 2020-08-25
Added
+++++
* Added support for celery 4
[1.2.0] - 2020-08-20
Removed +++++++
[1.1.0] - 2020-05-07
Added
+++++++
* Added support for python 3.8
Removed
+++++++
* Dropped support for Django < 2.2
[1.0.0] - 2020-03-18
Removed +++++++
[0.3.0] - 2019-12-15
Added
+++++
* Added support for Django 2.2
[0.2.1] - 2019-09-25
Changed +++++++
start_user_task
should only close obsolete connections if the current connection is NOT in an atomic block
(which fixes errors on devstack studio/course-publishing).[0.2.0] - 2019-08-30
Changed
+++++++
* Have the `start_user_task` receiver close obsolete connections before starting the task.
[0.1.9] - 2019-08-27
Changed +++++++
UserTaskArtifactAdmin
and UserTaskStatusAdmin
where ordering
attribute must be a tuple or list.[0.1.8] - 2019-08-22
Changed
+++++++
* Improve list display for `ModelAdmin`.
[0.1.7] - 2019-05-29
Changed +++++++
UserTaskArtifact.url
a TextField
with a URLValidator
instead of a URLField
.[0.1.6] - 2019-05-29
Changed
+++++++
* Upgrade requirements.
* Change ``max_length`` of ``UserTaskArtifact.url`` from 200 to 512.
[0.1.5] - 2017-08-03
Changed +++++++
[0.1.4] - 2017-01-30
Changed
+++++++
* Slightly improved handling of tasks which start before their status records
are committed (due to database transactions). Also documented how to avoid
this problem in the first place.
[0.1.3] - 2017-01-03
Changed +++++++
Succeeded
just because the task exited cleanly.before_task_publish
signal handler.[0.1.2] - 2016-12-05
Changed
+++++++
* Add a migration to explicitly reference the setting for artifact file storage.
This setting is likely to vary between installations, but doesn't affect the
generated database schema. This change should prevent ``makemigrations``
from creating a new migration whenever the setting value changes.
[0.1.1] - 2016-10-11
Changed +++++++
[0.1.0] - 2016-10-07
Added
+++++
* First attempt to release on PyPI.
FAQs
Management of user-triggered asynchronous tasks in Django projects
We found that django-user-tasks demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A survey of 500 cybersecurity pros reveals high pay isn't enough—lack of growth and flexibility is driving attrition and risking organizational security.
Product
Socket, the leader in open source security, is now available on Google Cloud Marketplace for simplified procurement and enhanced protection against supply chain attacks.
Security News
Corepack will be phased out from future Node.js releases following a TSC vote.