Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
BrianJKoopman opened this issue Jun 22, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@BrianJKoopman
Copy link
Member

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.

ocs/ocs/site_config.py

Lines 491 to 501 in 076105e

else:
# Use the agent_class to figure it out...
matches = 0
for dev in host_config.instances:
if dev['agent-class'] == agent_class:
if instance_config is not None:
raise RuntimeError(
f"Multiple matches found for agent-class={agent_class}"
" ... you probably need to pass --instance-id=")
instance_config = InstanceConfig.from_dict(
dev, parent=host_config)

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', '[email protected]'], ['--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.

@BrianJKoopman BrianJKoopman added the bug Something isn't working label Jun 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant