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

[Feature Request] Add parse.Prev() to get past scheduled events #322

Open
toni-moreno opened this issue Jun 18, 2020 · 1 comment
Open

Comments

@toni-moreno
Copy link

toni-moreno commented Jun 18, 2020

Hello.

I would like if there is an easy way to get parse.Prev(anytime) and if not, could be interesting to add , as a solution to get previous scheduled events.

Of course this new feature has no sense on an job scheduling system. ( in the future)

USE CASE

We work with cron to define "flexible periodical time windows" as mask for compute SLA's

this could be done with SLOTS of cron based activated/deactivated windows

SLOT1: 
* Activate "45 07 * * *"  
* Deactivate "45 08 * * *"
SLOT2: 
* Activate "05 12 * * * " 
* Deactivate "10 12 * * *" 

TimeWindow = SLOT1 && SLOT2

image

The previous state ( before 7am) depends on the closest event (could be 0 or 1 ) but I need something like that.

parser1.Parse("45 07 * * *" )
prev_active=parse1.Prev(7am) 
parser2.Parse("45 08 * * *" )
prev_deact=parse2.Prev(7am) 

if prev_active > prev_deact {
   past_state=1
} else {
   past_state = 0
}

In this case was 0 because closest event from deactivate schedule

Any Idea on how to do this work with this great cron tool?

Thank you very much!

@juliev0
Copy link

juliev0 commented Feb 1, 2022

I've added this PR to do this: #437

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

No branches or pull requests

2 participants