Skip to content

Command Slot

A slot represents a time period for which each definition should be run. This is dependant on the definitions frequency. For example, if the frequency is Daily, a slot is created for each day a definition is to be run.

Slots are generated in advance of when they are needed for ease of querying. This is controlled using a Django setting called COMMAND_SLOTS_CREATE_EXTRA_DAYS and is currently set to 10 days in the future.

Database Structure

Label Type Description Notes
id UUID
definition CommandDefinition Defines which definition this slot relates to
account CommandAccount Defines which account this slot relates to, if at all ℹ Optional depending on the definitions matrix
start_date DateTime Defines the start date/time of what this slot represents
end_date DateTime Defines the end date/time of what this slot represents
created DateTime When this slot was created, used for debugging purposes

Slot dependencies

Like command definitions, slots also have dependencies, although this relationship isn't explicit in the database. (there is no table that shows it)

Instead, a slot is a dependant on another if these conditions are met:

  • The slot has a definition which is a dependency on the current slot's definition
  • The slot's start_date/end_date overlaps with the current slots start_date/end_date

For example, in this example, if you treat command D/C/B as parents of A, command A will only run if D/C/B have run first.

Slot dependencies

Note

This logic is important when implementing start polices, as they are often influenced by the dependencies of various definitions.