WaitForL0File

Bases: KPFTranslatorFunction

Wait a short time to see if kpfassemble writes a new L0 file. If it does, print a log line with that file name.

KTL Keywords Used:

  • kpfassemble.LOUTFILE
Source code in kpf/spectrograph/WaitForL0File.py
 8
 9
10
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
class WaitForL0File(KPFTranslatorFunction):
    '''Wait a short time to see if `kpfassemble` writes a new L0 file.  If it
    does, print a log line with that file name.

    KTL Keywords Used:

    - `kpfassemble.LOUTFILE`
    '''
    @classmethod
    def pre_condition(cls, args, logger, cfg):
        pass

    @classmethod
    def perform(cls, args, logger, cfg):
        LOUTFILE = ktl.cache('kpfassemble', 'LOUTFILE')
        initial_LOUTFILE = LOUTFILE.read()
        timeout = 10
        found_new_file = LOUTFILE.waitFor(f'!="{initial_LOUTFILE}"',
                                          timeout=timeout)
        if found_new_file is True:
            log.info(f'kpfassemble wrote {LOUTFILE.read()}')
        else:
            log.debug('WaitForL0File did not find new file')


    @classmethod
    def post_condition(cls, args, logger, cfg):
        pass