-
Notifications
You must be signed in to change notification settings - Fork 32
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
feat(anta): Experimental feature - Add AIOHTTP transport for HTTPX #1088
base: main
Are you sure you want to change the base?
feat(anta): Experimental feature - Add AIOHTTP transport for HTTPX #1088
Conversation
CodSpeed Performance ReportMerging #1088 will not alter performanceComparing Summary
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to reviww tests
@@ -57,6 +57,7 @@ coverage.xml | |||
.hypothesis/ | |||
cover/ | |||
report.html | |||
.codspeed/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you need this? we have a codspeed file in .github I think
self._session = Device(**common_settings) | ||
return self._session | ||
|
||
async def _get_ssh_opts(self) -> SSHClientConnectionOptions: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does it need to be async?
@@ -466,6 +515,7 @@ async def _collect(self, command: AntaCommand, *, collection_id: str | None = No | |||
An identifier used to build the eAPI request ID. | |||
""" | |||
semaphore = await self._get_semaphore() | |||
session = await self._get_session() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we call this everytime? if self._session is alreaedy set we don't need ti right?
@@ -544,7 +590,8 @@ async def refresh(self) -> None: | |||
- hw_model: The hardware model of the device | |||
""" | |||
logger.debug("Refreshing device %s", self.name) | |||
self.is_online = await self._session.check_connection() | |||
session = await self._get_session() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
@@ -555,14 +602,21 @@ async def refresh(self) -> None: | |||
if self.hw_model is None: | |||
logger.critical("Cannot parse 'show version' returned by device %s", self.name) | |||
# in some cases it is possible that 'modelName' comes back empty | |||
# and it is nice to get a meaninfule error message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what the heck is meaninfule? :p and how did codespell not catch this?
@@ -342,3 +376,16 @@ async def connect_inventory(self) -> None: | |||
if isinstance(r, Exception): | |||
message = "Error when refreshing inventory" | |||
anta_log_exception(r, message, logger) | |||
|
|||
async def disconnect_inventory(self) -> None: | |||
"""Try to disconnect all devices in the inventory using their `close()` coroutine if available.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"""Try to disconnect all devices in the inventory using their `close()` coroutine if available.""" | |
"""Try to disconnect from all devices in the inventory using their `close()` coroutine if available.""" |
with Catchtime(logger=logger, message="Preparing the tests"): | ||
selected_tests = prepare_tests(selected_inventory, catalog, tests, tags) | ||
if selected_tests is None: | ||
try: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like we should implement disconnecting the inventory in a separate PR for clarity
|
||
|
||
def find_deepest_os_error(exc: BaseException) -> OSError | None: | ||
"""Find the most specific/deepest OSError in the chain of exceptions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we document why we need this in the docstring? (as we are taking it out from where it was)
~ that can be found in the LICENSE file. | ||
--> | ||
|
||
ANTA offers experimental features that may improve performance or add capabilities, but haven't been thoroughly tested in all environments. These features might require additional dependencies and special configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets add a warning box :D
|
||
### Using AIOHTTP Transport | ||
|
||
As an experimental alternative, ANTA supports using [AIOHTTP](https://docs.aiohttp.org/en/stable/) as the transport layer for HTTPX. This can improve performance for high-scale deployments by delegating connection pooling and socket-level message to AIOHTTP while maintaining HTTPX's API for higher-level HTTP operations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As an experimental alternative, ANTA supports using [AIOHTTP](https://docs.aiohttp.org/en/stable/) as the transport layer for HTTPX. This can improve performance for high-scale deployments by delegating connection pooling and socket-level message to AIOHTTP while maintaining HTTPX's API for higher-level HTTP operations. | |
As an experimental alternative, ANTA supports using [AIOHTTP](https://docs.aiohttp.org/en/stable/) as the transport layer for HTTPX. This can improve performance for high-scale deployments by delegating connection pooling and socket-level messages to AIOHTTP while maintaining HTTPX API for higher-level HTTP operations. |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Description
Add option to support AIOHTTP transport for HTTPX, related to encode/httpx#3215
Requires #680
Checklist:
pre-commit run
)tox -e testenv
)