CheckAllowScheduledCals

Bases: KPFFunction

Source code in kpf/utils/CheckAllowScheduledCals.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 CheckAllowScheduledCals(KPFFunction):
    '''
    '''
    @classmethod
    def pre_condition(cls, args):
        pass

    @classmethod
    def perform(cls, args):
        ALLOWSCHEDULEDCALS = ktl.cache('kpfconfig', 'ALLOWSCHEDULEDCALS')
        if ALLOWSCHEDULEDCALS.read() == 'Yes':
            print('ALLOWSCHEDULEDCALS is "Yes"')
        else:
            print('WARNING: ALLOWSCHEDULEDCALS is not "Yes"')
            try:
                msg = [f'KPF ALLOWSCHEDULEDCALS is not "Yes"',
                       f'',
                       f'End of Night script may not have been run properly',
                       ]
                SendEmail.execute({'Subject': 'KPF ALLOWSCHEDULEDCALS is not "Yes"',
                                   'Message': '\n'.join(msg)})
            except Exception as email_err:
                log.error(f'Sending email failed')
                log.error(email_err)

    @classmethod
    def post_condition(cls, argsKPFFunction):
        pass