-
Notifications
You must be signed in to change notification settings - Fork 43
Non-default connection and database location settings are not used #56
Comments
You need to pass you celery app for the celerybeatmongo.schedulers.MongoScheduler class instantiation: from celery import Celery
app = Celery('hello', broker='redis://localhost//')
app.conf.update({
"mongodb_scheduler_db": "test_database",
"mongodb_scheduler_url": "mongodb://localhost:27017",
})
from celerybeatmongo.schedulers import MongoScheduler
scheduler = MongoScheduler(app=app) |
I agree it would, however my requirement is running the Celery daemon as a linux service; so I cannot pass that reference. However there is a app reference already in the celery.beat.Schedular class, that MongoScheduler inherits. So bumping the super init call further up the method makes it available. I've created a fork with a proposed fix. |
When you run the command Can you share a sample that reproduce your problem? |
Yes I will do that as soon as I get the chance; have a busy weekend ahead so probably I’ll do that on Monday!
… Op 15 mei 2020 om 23:24 heeft Rafael Reuber ***@***.***> het volgende geschreven:
When you run the command celery beat -A proj -S celerybeatmongo.schedulers.MongoScheduler,
the celery beat command uses the value of the argument -A to pass the celery instance from you application to the MongoSheduler class.
Can you share a sample that reproduce your problem?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
No problem. Stay safe @P-T-I |
My code is fairly straight forward: MyApp:
beat.service:
Variables are loaded through a config file, I leave out most of the variables, just the ones that matter...
|
@rafaelreuber, any chance on reproducing? |
I noticed you're running celery beat as an systemd service. This problem just happens in this case? It works as expected when you run celery beat through terminal as follow?
|
Did MongoScheduler became MongoPersistentScheduler ? As I was affected by this issue, I updated with the latest release, but I can not start anymore celery beat with the command:
I tried :
But I got kind of auth error: |
Rafael,
Sorry, been away for a while; just tested it, there is no difference between systemd and command line activation, same results....
——————————
Paul
… Op 29 mei 2020 om 23:50 heeft Rafael Reuber ***@***.***> het volgende geschreven:
I noticed you're running celery beat as an systemd service. This problem just happens in this case?
It works as expected when you run celery beat through terminal as follow?
celery -A Myapp beat -l DEBUG -S celerybeatmongo.schedulers.MongoScheduler
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Hy @P-T-I I added some debug log on this fork. Please, install it using the following command:
Execute celerybeatmongo with DEBUG log level:
Paste the output here. |
Seems to do the trick; tried it for both the systemd service as well as running from the cli Output:
|
Hey @rafaelreuber I also installed your archive and it solved the problem ! But when I install the one one pypi repo, I have the problem I described in my last post. |
I sent some PR to this repository. I'm waiting @zakird review them. |
Even though I added the correct keys into my celery app.conf, celerybeat-mongo does not find / uses them and falls back to the default collection, db and host-uri.
For whatever reason the current_app.conf does not hold the keys above and the defaults are initialized. I confirmed that the above config is send correctly to the celery app, I can manually retrieve the settings and the values match as they where set in the app.conf.update above.
With some minor alterations to the MongoScheduler init method (close to the same changes @rafaelreuber suggests to the MongoScheduler instantiation) I was able to succesfully push non-default settings towards celerybeat-mongo.
The text was updated successfully, but these errors were encountered: