My program is supposed to run 24/7 and i want to be able to run some tasks at a certain hour/date.
I have already tried to work with aiocron but it only supports scheduling functions (not coroutines) and i have read that is not a really good library. My program is built so most if not all the tasks that i would want to schedule are built in coroutines.
Is there any other library that allows for such kind of task scheduling?
Or if not, any way of warping coroutines so they run of a normal function?
According to the examples at the link you provided, that does not appear to be the case. The functions decorated with
@asyncio.coroutine
are equivalent to coroutines defined withasync def
, and you can use them interchangeably.However, if you want to avoid aiocron, it is reasonably straightforward to use
asyncio.sleep
to postpone running a coroutine until an arbitrary point in time. For example:Example usage: