I'm try to use pyramid_celery. I managed to run simple tasks. But how with pyramid run of a periodic tasks? Where I need to write CELERYBEAT_SCHEDULE?
-
Can you explain what you've tried so far? In particular, could you add a [Short, Self-Contained, (Compilable) Correct Example](http://sscce.org/)? – Jeff Tratner Jul 06 '12 at 08:30
-
I used the standard example pyramid_celery_demo. But it does not show how tasks can be run periodically. – uralbash Jul 06 '12 at 08:41
-
well, couldn't you just set a cron job to run a script that you write invoking pyramid_celery? – Jeff Tratner Jul 06 '12 at 08:45
-
I need to schedule tasks to be queued for execution. Cron runs the job immediately. What can cause the job again twice. – uralbash Jul 06 '12 at 08:57
2 Answers
Using Pyramid with Celery does not require using pyramid_celery module - the latter is just a thin integration layer which may or may not make your life easier. In your case it looks like it doesn't make your life easier, right?
Both Pyramid and Celery have excellent and very detailed documentation. pyramid_celery
does not have detailed documentation. From my reading the code it looks like it reads celery configuration from paster .ini file (development.ini in case of pyramid_celery_demo app) - I have no idea how to stick a nested dict into an .ini file, but some commit messages suggest that it somehow should work.
In short, your options are:
read the code of
pyramid_celery
and figure out how it supposed to workwrite to the author of the package
drop the package and use plain Pyramid and plain Celery, enjoying nice and clear documentation.
Further reading the code suggests that they 'eval()' string values read from the .ini file to convert them to python structures, so I'd assume putting something like
CELERYBEAT_SCHEDULE = "{'key': 'value', 'another_key': 'another_value'}"
should do the trick...

- 11,892
- 2
- 41
- 52
you need to add below section to your developement.ini file of project
[celerybeat:task1]
task = app1.tasks.Task1
type = crontab
schedule = {"minute": 0}
schedule is the format you need to write in cron style.Task1 is the task to be executed . Hope you got it. For more details visit this link. https://pypi.python.org/pypi/pyramid_celery/

- 7,273
- 2
- 29
- 23