-
Notifications
You must be signed in to change notification settings - Fork 7
Ensure agents improvements #7612
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
Changes from 11 commits
5b5ecf5
6c492ef
8685e78
c517c68
0179dac
d71473c
ded5e6c
c8c05a8
18dcf34
243cb39
cc001e8
82c7e6c
25c6b74
da614fd
8228083
ffa50f0
2ec766f
ba6a018
1f09bd9
d29acf5
765bdef
6b3ae24
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -945,16 +945,18 @@ async def _init_agent_map(self) -> None: | |
| self.agent_map = cfg.agent_map.get() | ||
|
|
||
| async def _init_endpoint_names(self) -> None: | ||
| if self.hostname is not None: | ||
| await self.add_end_point_name(self.hostname) | ||
| else: | ||
| # load agent names from the config file | ||
| agent_names = cfg.agent_names.get() | ||
| if agent_names is not None: | ||
| for name in agent_names: | ||
| if "$" in name: | ||
| name = name.replace("$node-name", self.node_name) | ||
| await self.add_end_point_name(name) | ||
| assert self.agent_map is not None | ||
| endpoints: Iterable[str] = ( | ||
| [self.hostname] | ||
| if self.hostname is not None | ||
| else ( | ||
| self.agent_map.keys() | ||
| if cfg.use_autostart_agent_map.get() | ||
| else (name if "$" not in name else name.replace("$node-name", self.node_name) for name in cfg.agent_names.get()) | ||
| ) | ||
| ) | ||
| for endpoint in endpoints: | ||
| await self.add_end_point_name(endpoint) | ||
|
|
||
| async def stop(self) -> None: | ||
| await super().stop() | ||
|
|
@@ -1037,6 +1039,9 @@ async def update_agent_map(self, agent_map: dict[str, str]) -> None: | |
| await self._update_agent_map(agent_map) | ||
|
|
||
| async def _update_agent_map(self, agent_map: dict[str, str]) -> None: | ||
| if "internal" not in agent_map: | ||
| raise ValueError("The internal agent must be present in the agent map") | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we really want to hard fail on this? Shouldn't we take a more robust approach, i.e. add the internal agent to the agent_map if it's missing and 2) log a warning.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure. The current behavior was to drop the internal agent altogether, so I don't think we have to worry too much about it being a breaking change (the previous behavior is just breaking in a different way). In that sense I think we can afford it, and if we can afford it I think it's the sensible thing to do. It also corresponds with the environment setting update behavior.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @wouterdb what's your opinion on this?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it is strange for the agent to reject the entire agent map, in case an entry is missing (that it can easily put in there itself). I would understand if we reject the user input on the server side, here, I find it tricky, in that it can make existing, working setups stop working altogether. (this is code on the agent startup path) (the more I think about it, the more I am convinced this can't got into a patch release, it is breaking)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I'll change this.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| async with self._instances_lock: | ||
| self.agent_map = agent_map | ||
| # Add missing agents | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.