schedule icon indicating copy to clipboard operation
schedule copied to clipboard

Unable to schedule from a specific time and following a specific calendar

Open gigittygit opened this issue 1 year ago • 3 comments

The library supports scheduling until a certain time but not from time. Consequently, it is difficult to implement logic such as every hour on Monday-Friday from 11:30 to 12:30.

We created a custom function that generates a list of options, in this case

  • every().monday.at("11:30")
  • every().monday.at("12:30")
  • every().tuesday.at("12:30")
  • ..,
  • every().friday.at("12:30")

This implies 15 calls, as opposed to only 5 calls per each day, or just 1 call per calendar that sets Monday to Friday eligible.

With a more frequent schedule, this becomes even more prohibitive. In such a case, we just run the job at every().minute and exit early when outside of schedule from job function, i.e. manage schedule externally.

Any enhancements planned? Any idea how to enhance internally the library?

  • every().monday.from('11:30').to('12:30')
  • every().minute.on(calendar).from('11:30').to('12:30')

gigittygit avatar Aug 28 '23 09:08 gigittygit

@SijmenHuizenga could you please assess feasibility and complexity arising from scheduling

  • from specific time (e.g. every minute from 11:00 to 11:30),
  • on specific week days (e.g. monday to friday),
  • following specific calendar (e.g. list of datetime objects)?

I agree with @dbader sentiment to keep this library lightweight and not turn it into next large unmaintainable project (#219). However, I believe the above could considerably increase expressiveness at little cost.

-- A huge fan of this library

gigittygit avatar Aug 30 '23 08:08 gigittygit

So, the disregard and silence of @SijmenHuizenga for several months, meaning this suggested improvement won't be considered? Many individuals including myself in high demand for this feature, believe that it could bring significant enhancements with minimal cost.

ywgdjryf avatar Dec 06 '23 01:12 ywgdjryf

This is one of the prominent use cases for me. I do it via hacky ways for now by refreshing schedule before and after the from and to times and skipping scheduling the jobs outside of those times. This can make my life so easy!

EDIT: Another issue with the same requirement exists. Track it here. https://github.com/dbader/schedule/issues/568 In fact, this issue should be closed in favor of the one I linked.

kulbirsaini avatar Aug 22 '24 13:08 kulbirsaini