simonsobs / simonsobs/ocs

Typos in 'agent-class' key in a SCF can prevent all agents relying on agent-class matching to not start-up

Open Beginner friendly
#275 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
19
Forks
7
PR merge metrics
No merged PRs in 30d

Description

Just ran into this problem at Penn. There was a subtle typo in the configuration of a new Agent, 'agent-class' was typo'd to 'agent_class'.

The agent-class matching loops over all agent blocks in the SCF and will hit a KeyError when it can't find the 'agent-class' key.

https://github.com/simonsobs/ocs/blob/076105e9613ef78745d37df3d9bf8a38ce1e28bd/ocs/site_config.py#L491-L501

Here's an abbreviated log with a print(dev) before line 495 (where I've just trimmed other valid agent configs):

2022-06-22T23:14:54+0000 {'agent-class': 'CrateAgent', 'instance-id': 'crate1-monitor', 'manage': 'docker', 'arguments': [['--shm-addr', 'root@192.168.1.2'], ['--crate-id', 'crate1']]}
2022-06-22T23:14:54+0000 {'agent-class': 'DLMAgent', 'instance-id': 'dlm', 'manage': 'docker', 'arguments': [['--ip-address', '10.10.10.21'], ['--port', '9221']]}
2022-06-22T23:14:54+0000 {'agent_class': 'starcam_Agent', 'instance-id': 'starcam', 'manage': 'docker', 'arguments': [['--ip-address', '10.10.10.167'], ['--user-port', '8000']]}
2022-06-22T23:14:54+0000 Traceback (most recent call last):
2022-06-22T23:14:54+0000   File "influxdb_publisher.py", line 160, in <module>
2022-06-22T23:14:54+0000     args = site_config.parse_args(agent_class='InfluxDBAgent', parser=parser)
2022-06-22T23:14:54+0000   File "/usr/local/lib/python3.8/dist-packages/ocs/site_config.py", line 718, in parse_args
2022-06-22T23:14:54+0000     site, host, instance = get_config(pre_args, agent_class=agent_class)
2022-06-22T23:14:54+0000   File "/usr/local/lib/python3.8/dist-packages/ocs/site_config.py", line 496, in get_config
2022-06-22T23:14:54+0000     if dev['agent-class'] == agent_class:
2022-06-22T23:14:54+0000 KeyError: 'agent-class'

The side-effect is any Agent relying on this matching to know it's config will not start-up.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in ocs/site_config.py at the agent-class matching loop around lines 491-501, tracing how get_config is called by parse_args. Reproduce the failure with an agent block using agent_class, then verify that an incorrectly keyed block no longer prevents other agents from starting.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.