buildbox-2.2.1.1: Rehackable components for writing buildbots and test harnesses.

Safe HaskellSafe
LanguageHaskell98

BuildBox.Data.Schedule

Contents

Description

A schedule of commands that should be run at a certain time.

Synopsis

Time Periods

When

data When Source #

When to invoke some event.

Constructors

Always

Just keep doing it.

Never

Don't do it, ever.

Every NominalDiffTime

Do it some time after we last started it.

After NominalDiffTime

Do it some time after it last finished.

Daily TimeOfDay

Do it each day at this time. The 'days' are UTC days, not local ones.

data WhenModifier Source #

Modifier to when.

Constructors

Immediate

If the event hasn't been invoked before then do it immediately when we start the cron process.

WaitUntil UTCTime

Wait until after this time before doing it first.

Events

data Event Source #

Records when an event should start, and when it last ran.

Constructors

Event 

Fields

earliestEventToStartAt :: UTCTime -> [Event] -> Maybe Event Source #

Given the current time and a list of events, determine which one should be started now. If several events are avaliable then take the one with the earliest start time.

eventCouldStartAt :: UTCTime -> Event -> Bool Source #

Given the current time, decide whether an event could be started. If the WhenModifier is Immediate this always returns true. The SkipFirst modifier is ignored, as this is handled separately.

Schedules

data Schedule cmd Source #

Map of event names to their details and build commands.

Constructors

Schedule (Map EventName (Event, cmd)) 

makeSchedule :: [(EventName, When, Maybe WhenModifier, cmd)] -> Schedule cmd Source #

A nice way to produce a schedule.

lookupEventOfSchedule :: EventName -> Schedule cmd -> Maybe Event Source #

Given an event name, lookup the associated event from a schedule.

lookupCommandOfSchedule :: EventName -> Schedule cmd -> Maybe cmd Source #

Given an event name, lookup the associated build command from a schedule.

adjustEventOfSchedule :: Event -> Schedule cmd -> Schedule cmd Source #

Given a new version of an event, update any matching event in the schedule. If the event not already there then return the original schedule.

eventsOfSchedule :: Schedule cmd -> [Event] Source #

Get the list of events in a schedule, ignoring the build commands.

Orphan instances