Ejemplo n.º 1
0
    def _init(cls):
        """Initialize the Instance."""
        with cls._lock:
            if cls._hl_triggers:
                return
            if not _web.server_online():
                raise Exception('Could not connect with Consts Server!!')
            text1 = _web.high_level_triggers(timeout=_timeout)
            text2 = _web.high_level_events(timeout=_timeout)
            temp_dict = _ast.literal_eval(text1)
            hl_trigs = dict()
            for k, vs in temp_dict.items():
                vs['channels'] = tuple(map(_PVName, vs['channels']))
                hl_trigs[_PVName(k)] = vs
            cls._hl_triggers = hl_trigs
            cls._hl_events = _ast.literal_eval(text2)

            hl2ll = dict()
            for hlt, val in cls._hl_triggers.items():
                chans = val['channels']
                hl2ll[hlt] = {_LLSearch.get_trigger_name(c) for c in chans}
            ll2hl = dict()
            for k, vs in hl2ll.items():
                ll2hl.update({v: k for v in vs})
            cls._hl2ll_trigs = hl2ll
            cls._ll2hl_trigs = ll2hl
Ejemplo n.º 2
0
 def _get_data(cls):
     with cls._lock:
         if cls._mapping is not None:
             return
         if not _web.server_online():
             raise Exception('could not read data from web server!')
         text = _web.bpms_data(timeout=_timeout)
         cls._build_mapping(text)
         cls._build_timing_to_bpm_mapping()
Ejemplo n.º 3
0
 def server_online(cls):
     """Return True/False if Sirius web server is online."""
     return _web.server_online()