Skip to content

Database worker stuck after internal exception #190

@stefan6419846

Description

@stefan6419846

Running django-tasks with the database backend lets a worker run forever without any activity.

Example:

# jobs.py
from django_tasks import task, TaskContext


@task(takes_context=True, queue_name='test01')
def calculate_meaning_of_life(context: TaskContext) -> int:
    print(context)
    return 42


if __name__ == '__main__':
    print(calculate_meaning_of_life.enqueue())

Run this file twice. We will have two tasks with the task path __main__.calculate_meaning_of_life (which does not look right as well).

Starting the respective worker now will fail to resolve the task path and raise an ImportError for the first task result, which goes into the state "Failed". Afterwards, the worker seems to be broken and the second task result remains "Ready". I would have expected the worker to just continue with the next task result.

If the exception is raised inside the task itself, the worker is not getting stuck.

Metadata

Metadata

Assignees

No one assigned

    Labels

    database-backendIssues relating to the database backend

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions