Skip to content

Instantly share code, notes, and snippets.

@Senhaji-Rhazi-Hamza
Last active November 12, 2021 16:23
Show Gist options
  • Select an option

  • Save Senhaji-Rhazi-Hamza/7af33afd3560de606de9812110fb234f to your computer and use it in GitHub Desktop.

Select an option

Save Senhaji-Rhazi-Hamza/7af33afd3560de606de9812110fb234f to your computer and use it in GitHub Desktop.
# worker.py
from py_workers.config import CeleryConfig
from celery import Celery
celery_app = Celery(
main=CeleryConfig.APP_NAME,
backend=CeleryConfig.CELERY_RESULT_BACKEND,
broker=CeleryConfig.BROKER_URL,
include=[
"py_workers.tasks.example.arithmetic",
],
)
# celery_app.conf.task_routes = {'py_workers.tasks.*': {'queue': 'pyqueue'}}
celery_app.conf.task_routes = {"py_workers.tasks.*": {"queue": CeleryConfig.QUEUE}}
if __name__ == "__main__":
celery_app.start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment