Document the format of the manual configuration file and add --get-device-capabilities #809
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch does two things to assist users that make use of the manual peer discovery system.
First, it adds a comment that documents the format of the config file that --discovery-config-path is expecting. As far as I can tell, nowhere in the source or documentation shows how this file is supposed to look.
Second, it adds a command-line parameter called --get-device-capabilities that outputs the current device's device_capabilities block. We needed this to be able to automate creating the manual configuration file, since those values aren't really easy to determine outside of exo. Example:
This is a little hairy because it needs to execute BEFORE anything else can output to the console, but the asyncio loop hasn't been started until after other things have been printed out and all the device capability code is async. So I added a small function to helpers.py to create a tiny event loop. There's probably a better way of refactoring this so all the real argument processing and startup happens in main() instead of at the top level, but that seemed too invasive for such a small feature. Maybe config_uvloop could execute earlier, but I'm not sure of the history for why that's pulled out separately.