CheckSoCalEnabled

Bases: KPFFunction

Source code in kpf/socal/CheckSoCalEnabled.py
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
class CheckSoCalEnabled(KPFFunction):
    '''
    '''
    @classmethod
    def pre_condition(cls, args):
        pass

    @classmethod
    def perform(cls, args):
        CAN_OPEN = ktl.cache('kpfsocal', 'CAN_OPEN')
        if CAN_OPEN.read(binary=True) == True:
            print('CAN_OPEN is True')
        else:
            print('WARNING: CAN_OPEN is not True')
            try:
                msg = [f'KPF SoCal CAN_OPEN is not True',
                       f'',
                       f'SoCal is disabled.',
                       ]
                SendEmail.execute({'Subject': 'KPF SoCal CAN_OPEN is not True',
                                   'Message': '\n'.join(msg)})
            except Exception as email_err:
                log.error(f'Sending email failed')
                log.error(email_err)

    @classmethod
    def post_condition(cls, args):
        pass