lsst.sims.ocs.kernel.downtime_handler module

class lsst.sims.ocs.kernel.downtime_handler.DowntimeHandler[source]

Bases: future.types.newobject.newobject

Coordinate the handling of all the downtime information.

This class handles the coordination between the scheduled and unscheduled downtime information.

scheduled

ScheduledDowntime – The scheduled downtime information instance.

unscheduled

UnscheduledDowntime – The unscheduled downtime information instance.

current_scheduled

tuple or None – The set of current scheduled downtime information.

current_unscheduled

tuple or None – The set of current unscheduled downtime information.

downtime_days

set – The holder for the list of downtime days.

log

Logger – The handle for the logger.

Initialize the class.

downtime_range(dt)[source]

Get the downtime day range and start night.

Parameters:dt (tuple) – The collection of downtime information (start, length, description)
Returns:set, int – The list of downtime days as a set and the downtime start night.
get_downtime(night)[source]

Determine if there is downtime for the given night.

This function looks at the given downtime and determines if there are any downtime days. If downtime is identified, then this number will return a decreasing number of days until no more downtime if found.

Parameters:night (int) – The night to check the downtime information for.
Returns:int – The number of downtime nights.
initialize(config)[source]

Perform initialization steps.

Parameters:config (Downtime) – Downtime configuration instance.
update()[source]

Update the lsit of downtime days.

write_downtime_to_db(db)[source]

Write all the downtime information to the survey database.

Parameters:db (SocsDatabase) – The instance of the survey database.