Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the functionality to run jobs at monthly or yearly intervals on specific dates #565

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

masa-08
Copy link
Contributor

@masa-08 masa-08 commented Feb 16, 2023

resolve #487

This PR will implement the feature discussed in the above issue.

To summarize this issue

  • The functionality to schedule on a monthly or yearly unit is needed.
  • Considering the job persistence that @gabrielcipriano points out, we should not simply add the functionality to schedule on a monthly or yearly unit.
  • In light of these considerations, it is desirable to design the system to allow scheduling on a monthly or yearly unit as long as the specific dates are specified, which is the idea of @ttamg.

Therefore, I have implemented the feature that allows scheduling on a monthly or yearly unit by specifying a specific date.

This feature can be used as follows

# Run jobs on the 5th of each month.
schedule.every().date("05").do(job)
# Run jobs at 9:00 on Dec 5th every two years.
schedule.every(2).date("12/05").at("09:00").do(job)

Your review and comments would be greatly appreciated.

@masa-08 masa-08 changed the title Add the functionality to run jobs at specified intervals on specific dates Add the functionality to run jobs at monthly or yearly intervals on specific dates Feb 16, 2023
@c0d3rman
Copy link

c0d3rman commented Oct 1, 2023

Any progress on merging this? I also need this functionality.

@detheavn
Copy link

I agree monthly and yearly would be great additions, but I would like to make an additional suggestion for the monthly, namely the first and last of the month with offsets:
.firstof() would then be the 1st of the month
.lastof() would be the last of the month.

Offsets could then be done as follows:
.firstof(1) would then be the 2nd of the month
.lastoff(1) would then be the day before the last day of the month.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

supports "months" and "years” interval
3 participants