Ask Your Question
0

How to create a local configuration file for celery daemon in production environment without using Django?

asked 2023-06-16 03:11:09 +0000

qstack gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2023-06-16 03:27:01 +0000

ladyg gravatar image

To create a local configuration file for celery daemon in production environment without using Django, you can follow these steps:

  1. Create a configuration file: Create a file named 'celeryconfig.py' in your project directory. This file will contain the configuration options for the Celery daemon.

  2. Set the broker URL: Set the 'BROKER_URL' variable in the configuration file to the URL of your message broker. For example, if you are using RabbitMQ, the URL will be something like 'amqp://guest:guest@localhost:5672/'.

  3. Configure the task result backend: Set the 'CELERYRESULTBACKEND' variable to the URL of your task result backend. For example, if you are using Redis, the URL will be something like 'redis://localhost:6379/0'.

  4. Set the task time limit: Set the 'CELERYDTASKSOFTTIMELIMIT' and 'CELERYDTASKTIME_LIMIT' variables to specify the maximum time a task can run before it is terminated.

  5. Set the concurrency level: Set the 'CELERYD_CONCURRENCY' variable to specify the number of worker processes to run.

  6. Set the log level: Set the 'CELERYDLOGLEVEL' variable to specify the log level for the daemon.

  7. Start the celery daemon: Start the Celery daemon by running the command 'celery worker -A <module_name> -c <concurrency_level>', where '<module_name>' is the name of the Python module that contains the Celery app, and '<concurrency_level>' is the number of worker processes to run.

  8. Verify the configuration: Verify that the Celery daemon is running correctly by executing some tasks and checking their results.

By following the above steps, you can create a local configuration file for the Celery daemon in your production environment without using Django.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-06-16 03:11:09 +0000

Seen: 14 times

Last updated: Jun 16 '23