Live values are stored in the core and their fetch is relatively cheap as it only requires locking the core live values lock Signal descriptors are a much heavier call as they query the connector registry and trigger an O(n) search throughout the different endpoints, this method is not meant to be used heavily as it requires locking multiple locks and handling alot of data, this method is meant to be called once to retreive a list of signal descriptors that the user can then store and use to reference values against in their frontend code
31 lines
711 B
Python
31 lines
711 B
Python
import logging
|
|
|
|
from rich.logging import RichHandler
|
|
|
|
from dynalab_core import Core
|
|
from dynalab_core.config import CoreConfig
|
|
|
|
logging.basicConfig(
|
|
level=logging.DEBUG,
|
|
format="%(name)s %(message)s",
|
|
datefmt="%H:%M:%S",
|
|
handlers=[RichHandler(rich_tracebacks=True, show_path=False)],
|
|
force=True,
|
|
)
|
|
log = logging.getLogger(__name__)
|
|
|
|
|
|
config = CoreConfig(port=8765)
|
|
log.info("Configured manual core on %s", config.bind_str())
|
|
dl_core = Core(config)
|
|
dl_core.start()
|
|
|
|
try:
|
|
while True:
|
|
dl_core.wait(1)
|
|
values = dl_core.get_all_live_values()
|
|
log.debug(f"Core values: {values}")
|
|
except KeyboardInterrupt:
|
|
log.info("Received keyboard interrupt")
|
|
dl_core.stop()
|