Re:Schedule (Python)
by abishekg on Sunday December 12, 2021 @06:53PM
(#29534962)
I understand celery is the other way to do this? Can I replace celery based schedule with this one? Seems much simpler..
[ Parent
| on HN ]
Re:Schedule (Python)
by alpineidyll3 on Sunday December 12, 2021 @08:02PM
(#29535415)
I use it as a celery replacement.
It's crazy how these two are the main competitors for such an essential function.
Really this type of Cron function should be a part of any standard library.
Re:Schedule (Python)
by chadykamar on Sunday December 12, 2021 @08:39PM
(#29535608)
There is https://docs.python.org/3/library/sched.html in the standard library.
Re:Schedule (Python)
by nodesocket on Monday December 13, 2021 @12:00AM
(#29536795)
Schedule does not have persistence. When the python process stops you lose all jobs.
For a Django app, I use JSON serialisation of input data to store jobs in an sqlite database. the function to run is stored as a python path; a string, that is evaluated when the job is ran. result or exceptions are written to database. That way I can get away with the standard library's schedule just fine. Of course, for these specific jobs it's ok if they run more than once so there's no mutexes needed.