buildbox- Rehackable components for writing buildbots and test harnesses.

Safe HaskellSafe




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


Time Periods


data When Source

When to invoke some event.



Just keep doing it.


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.



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.


data Event Source

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




eventName :: EventName

A unique name for this event. Used when writing the schedule to a file.

eventWhen :: When

When to run the command.

eventWhenModifier :: Maybe WhenModifier

Modifier to the previous.

eventLastStarted :: Maybe UTCTime

When the event was last started, if any.

eventLastEnded :: Maybe UTCTime

When the event last finished, if any.

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.


data Schedule cmd Source

Map of event names to their details and build commands.


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.