Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to define task queue for the django-import-export-celery task #81

Open
xalien10 opened this issue Nov 29, 2022 · 2 comments
Open

How to define task queue for the django-import-export-celery task #81

xalien10 opened this issue Nov 29, 2022 · 2 comments

Comments

@xalien10
Copy link
Collaborator

In my django application I'm using a task queue. Whenever, I try to execute model export, it doesn't triggering the django-import-export-celery task. May be I need to define task queue for the shared_task from this library. I wanted to ask, if there is any way to override the queue settings so that the task will be executed on the right celelry task queue? @auto-mat

@d-kahara
Copy link

Hi @xalien10 did you get this working?

@xalien10
Copy link
Collaborator Author

I found no settings for defining queue name for django-import-export-celery. So, I updated my celery config file the following way to define the queue configuration of the celery tasks.

import os

from celery import Celery
from celery.utils.log import get_task_logger

logger = get_task_logger("app")

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "conf.settings")
app = Celery("apps")
app.config_from_object("django.conf:settings", namespace="CELERY")
app.autodiscover_tasks()

app.conf.timezone = "UTC"

app.conf.task_routes = {
    "import_export_celery.tasks.*": {
            "queue": "<YOUR-DESIRED-QUEUE-NAME>"
        }
}

@d-kahara

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants