Skip to content

Commit

Permalink
Use provider.enforce_field_name_rules to correct field names
Browse files Browse the repository at this point in the history
  • Loading branch information
jlashner committed Nov 19, 2020
1 parent c2a1636 commit 700b889
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion agents/registry/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from collections import defaultdict
from ocs.ocs_feed import Feed

from ocs.agent.aggregator import Provider

class RegisteredAgent:
"""
Expand Down Expand Up @@ -114,7 +115,7 @@ def main(self, session: ocs_agent.OpSession, params=None):
The session.data object for this process will be a dictionary containing
the encoded RegisteredAgent object for each agent observed during the
lifetime of the registry. For instance, this might look like
>>> session.data
{'observatory.aggregator':
{'expired': False,
Expand Down Expand Up @@ -153,6 +154,7 @@ def main(self, session: ocs_agent.OpSession, params=None):
field = f'{addr}_{op_name}'
field = field.replace('.', '_')
field = field.replace('-', '_')
field = Provider._enforce_field_name_rules(field)
try:
Feed.verify_data_field_string(field)
except ValueError as e:
Expand Down
2 changes: 1 addition & 1 deletion docs/agents/registry.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ The registry is also used to track the status of each agent's tasks and
processes. `Operation codes` for each operation are regularly passed through an
agent's heartbeat feed, which the registry assembles and publishes through its
own OCS feed. This makes it possible to monitor individual operation states in
grafan and to easily set alerts when a process stops running or when a task
grafana and to easily set alerts when a process stops running or when a task
fails.

By mapping the enumeration values described in the ``OpCode`` documentation in
Expand Down

0 comments on commit 700b889

Please sign in to comment.