Skip to content

Commit

Permalink
Add default error logging to all measurement channels of component lo…
Browse files Browse the repository at this point in the history
…gging.

PiperOrigin-RevId: 654920109
Change-Id: I616bbcac9caceb74bd78d41f0943122744b7bc6a
  • Loading branch information
duenez authored and copybara-github committed Jul 22, 2024
1 parent 2684366 commit f7d1656
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion concordia/agents/entity_agent_with_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from collections.abc import Mapping
import types
from typing import Any
from absl import logging

from concordia.agents import entity_agent
from concordia.typing import agent
Expand Down Expand Up @@ -69,7 +70,9 @@ def __init__(
self._component_logging.get_channel(channel) # pylint: disable=attribute-error pytype mistakenly forgets that `_component_logging` is not None.
for channel in self._channel_names
]
rx.with_latest_from(self._tick, *channels).subscribe(self._set_log)
rx.with_latest_from(self._tick, *channels).subscribe(
self._set_log,
on_error=lambda e: logging.error('Error in component logging: %s', e))
else:
self._channel_names = []

Expand Down

0 comments on commit f7d1656

Please sign in to comment.