I'm trying to get running the Huey task queue for python (it's a Celery alternative) and I'm stuck with starting the consumer with main.Configuration (as it's written in the tutorial). I know the huey_consumer is looking for the configfile somewhere in the python, but I cannot get it working according to the tutorial and I don't know why I should write a config file and load it as a module (instead of a file).
When I run huey_consumer.py main.Configuration
it returns Unable to import "main"
.
Huey have this issue written in their common pitalls too, but it's not really helping either.
If there is somebody using Huey, please help me.
To run the consumer, simply point it at the “import path” to your application’s Huey instance. For example, here is how I run it on my blog: The concept of the “import path” has been the source of a few questions, but it is quite simple.
The consumer consists of a main process, a scheduler, and one or more workers. These individual components all run concurrently, and Huey supports three different mechanisms to achieve this concurrency. thread, the default - uses OS threads.
Tasks enqueued for immediate execution will be run regardless of whether the scheduler is running. You only need to start the scheduler if you plan to schedule tasks in the future or run periodic tasks. Huey comes with special integration for use with the Django framework.
The huey.contrib package contains modules that provide extra functionality beyond the core APIs. MiniHuey provides a very lightweight huey-like API that may be useful for certain applications. The MiniHuey consumer runs inside a greenlet in your main application process.
I had the same problem and solved it by adding the directory containing main.py to the PYTHONPATH. There was no need to copy huey_consumer.py
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With