Created
December 22, 2015 13:40
-
-
Save juanwolf/94840f4bd3896aa38671 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
crontab = settings.CELERYBEAT_SCHEDULE['mytask']['schedule'] | |
# We get the duration until the next execution | |
delta = crontab.remaining_estimate(crontab.now()) | |
# We get the datetime of the next execution | |
next_exec = datetime.now() + delta | |
# We get the duration between two execution | |
duration = crontab.remaining_estimate(next_exec) - delta | |
# So the last run is the next_exec minus the duration between two task. | |
last_run = next_exec - duration |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment