Skip to content

Conversation

CoreyEWood
Copy link
Contributor

@CoreyEWood CoreyEWood commented Sep 24, 2025

This PR includes two distinct changes.

  • Adds a new parameter http_transport_retries to the Groundlight constructor, enabling the retry behavior to be modified when initializing a Groundlight instance.
    • The retry behavior specified will apply to all API requests made through the Groundlight instance.
    • Currently no way is provided to configure the retry behavior per-request, or to change it once the Groundlight instance has been initialized (this is technically possible but awkward).
    • I added a test to verify that we can pass the parameter in and it gets passed through to the inner API client.
  • Adds a request_timeout parameter to the get_detector method which enables changing the request timeout values for the request.
    • An identical parameter was previously added for submit_image_query. Eventually I think we'll want to make this available for all methods, but for now we don't need that.
    • I added a test to verify that this parameter works properly.

These changes are intended to be utilized by the edge endpoint to improve behavior under poor network connectivity.

Comment on lines +144 to +150
If not provided, will attempt to read from the "GROUNDLIGHT_API_TOKEN" environment variable.
:param disable_tls_verification: If True, disables SSL/TLS certificate verification for API calls.
When not specified, checks the "DISABLE_TLS_VERIFY" environment variable
(1=disable, 0=enable). Certificate verification is enabled by default.
When not specified, checks the "DISABLE_TLS_VERIFY" environment variable (1=disable, 0=enable).
Certificate verification is enabled by default.
Warning: Only disable verification when connecting to a Groundlight Edge
Endpoint using self-signed certificates. For security, always keep
verification enabled when using the Groundlight cloud service.
Warning: Only disable verification when connecting to a Groundlight Edge Endpoint using self-signed
certificates. For security, always keep verification enabled when using the Groundlight cloud service.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just corrected the formatting on these.

requests = "^2.28.2"
typer = "^0.15.4"
urllib3 = "^1.26.9"
urllib3 = "^2.5.0"
Copy link
Contributor Author

@CoreyEWood CoreyEWood Sep 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This upgrade is necessary for the retries parameter on the Configuration to actually be respected when requests are made. 2.5.0 is the most recent release - likely the fix was made earlier, but I don't see a reason not to update to the most recent (let me know if you know of a reason not to upgrade this, though).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds like a nasty debug for you. The upgrade makes perfect sense

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was indeed a hairy process!

Copy link
Collaborator

@brandon-wada brandon-wada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, I like it

requests = "^2.28.2"
typer = "^0.15.4"
urllib3 = "^1.26.9"
urllib3 = "^2.5.0"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds like a nasty debug for you. The upgrade makes perfect sense

metadata: Union[dict, str, None] = None,
image_query_id: Optional[str] = None,
request_timeout: Optional[float] = None,
request_timeout: Optional[Union[float, Tuple[float, float]]] = None,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's a Tuple[float, float] do here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The request timeout has two components, the "connect timeout" and the "read timeout". If you supply a single number, that will be the value for the total timeout between both of those. If you supply a tuple with two values, it'll use those values as (connect_timeout, read_timeout).

@CoreyEWood CoreyEWood merged commit 2f2ebd5 into main Sep 25, 2025
8 checks passed
@CoreyEWood CoreyEWood deleted the configurable-retries branch September 25, 2025 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants