예제 #1
0
def _get_setting_entry(state, address):
    setting = Setting()

    try:
        entries_list = state.get([address], timeout=STATE_TIMEOUT_SEC)
    except FutureTimeoutError:
        LOGGER.warning('Timeout occured on state.get([%s])', address)
        raise InternalError('Unable to get {}'.format(address))

    if len(entries_list) != 0:
        setting.ParseFromString(entries_list[0].data)

    return setting