AlarmRuleRunner#

class lsst.ts.watcher.AlarmRuleRunner(rule_name, index)#

Bases: Controller

Parameters:

Methods Summary

amain()

Run an AlarmRuleRunner instance from the command line.

close_tasks()

Close all tasks.

deescalate_alarm(alarm)

De-escalate an alarm by resolving the associated SquadCast incident.

do_acknowledge(data)

Acknowledge the alarm of this rule.

do_configure(data)

Configure the currently loaded alarm rule.

do_mute(data)

Mute the alarm of this rule.

do_run(data)

Run the alarm rule.

do_stop(data)

Stop the alarm rule.

do_unacknowledge(data)

Unacknowledge the alarm of this rule.

do_unmute(data)

Unmute the alarm of this rule.

escalate_alarm(alarm)

Escalate an alarm by creating a SquadCast incident.

make_from_cmd_line()

Creates an instance of the class using command-line arguments.

output_alarm(alarm)

Output the alarm event for one alarm.

start()

Finish construction and start running the alarm rule.

Methods Documentation

async classmethod amain()#

Run an AlarmRuleRunner instance from the command line.

Return type:

None

async close_tasks()#

Close all tasks.

Return type:

None

async deescalate_alarm(alarm)#

De-escalate an alarm by resolving the associated SquadCast incident.

Clear alarm.escalated_id and, if alarm.escalated_id is valid (does not start with “Failed”), tell SquadCast to close the alert.

async do_acknowledge(data)#

Acknowledge the alarm of this rule.

Parameters:

data (cmd_acknowledge.DataType) – The data for the acknowledge command.

Return type:

None

async do_configure(data)#

Configure the currently loaded alarm rule.

Parameters:

data (cmd_configure.DataType) – Configuration.

Raises:

salobj.ExpectedError – If self.state.state is not lsst.ts.xml.enums.AlarmRule.AlarmRuleState.UNCONFIGURED.

Return type:

None

async do_mute(data)#

Mute the alarm of this rule.

Parameters:

data (cmd_mute.DataType) – The data for the mute command.

Return type:

None

async do_run(data)#

Run the alarm rule.

The alarm rule must have been configured.

Parameters:

data (cmd_run.DataType) – Ignored.

Raises:

salobj.ExpectedError – If self.state.state is not lsst.ts.xml.enums.Script.AlarmRuleState.CONFIGURED.

Return type:

None

async do_stop(data)#

Stop the alarm rule.

Parameters:

data (cmd_stop.DataType) – Ignored.

Return type:

None

Notes

This is usually called when the Watcher goes to DISABLED state.

async do_unacknowledge(data)#

Unacknowledge the alarm of this rule.

Parameters:

data (cmd_unacknowledge.DataType) – The data for the unacknowledge command.

Return type:

None

async do_unmute(data)#

Unmute the alarm of this rule.

Parameters:

data (cmd_unmute.DataType) – The data for the unmute command.

Return type:

None

async escalate_alarm(alarm)#

Escalate an alarm by creating a SquadCast incident.

Store the ID of the alert in alarm.escalation_id. If the attempt fails, store an error message that begins with “Failed: “ in alarm.escalation_id.

If self.model.config.escalation_url is blank, then check the conditions in the Raises section but do nothing else.

Raises:

RuntimeError – If pre-conditions are not met (escalation is not attempted): * alarm.escalated_id is not blank: the alarm was already escalated (or at least an attempt was made). * alarm.do_escalate false: alarm should not be escalated. * alarm.escalation_responder empty: there is nobody to escalate the alarm to (so do_escalate should never have been set).

classmethod make_from_cmd_line()#

Creates an instance of the class using command-line arguments.

This class method processes command-line arguments passed in as keyword arguments. It converts the specified arguments into parameters required to create an instance of the class.

Returns:

Returns an instance of AlarmRuleRunner if the necessary arguments are correctly provided.

Return type:

AlarmRuleRunner

Raises:

argparse.ArgumentError – If there are issues with parsing command-line arguments.

async output_alarm(alarm)#

Output the alarm event for one alarm.

async start()#

Finish construction and start running the alarm rule.

Return type:

None