Skip to content

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

Open
@toni-moreno

Description

@toni-moreno

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions