Skip to content

Conversation

@CoreyEWood
Copy link
Contributor

No description provided.

@CoreyEWood CoreyEWood changed the title Enable submit_image_query to accept request_timeout through kwargs Add request_timeout as a param for submit_image_query Jun 9, 2025
@CoreyEWood CoreyEWood marked this pull request as ready for review June 9, 2025 23:13
@timmarkhuff
Copy link
Contributor

How does this differ from wait?

What happens if a user sets a request_timeout that is less than wait?

Should this parameter be made available to convenience methods, such as ask_confident?

@CoreyEWood CoreyEWood requested a review from brandon-wada June 11, 2025 21:21
@CoreyEWood
Copy link
Contributor Author

How does this differ from wait?

What happens if a user sets a request_timeout that is less than wait?

Should this parameter be made available to convenience methods, such as ask_confident?

This is how long the internal IQ submission API request will be attempted before giving up, e.g., in a scenario where there's no internet connection. So it's very 'internal workings' and doesn't really interact with the other parameters like wait. Do you think I should clarify that further in the docstring?

In terms of making this available to other methods, this is being added for the edge to be able to use it and I don't really envision anyone else needing it/wanting to set it. When Brandon and I discussed, we thought it would be simplest to just add it to submit_image_query for now. If it ends up being more widely desired, it could eventually get added to the other methods too.

@timmarkhuff
Copy link
Contributor

of making this available to other methods, this is being added for the edge to be able to use it and I don't really envision anyone else needing it/wanting to set it. When Brandon and I discussed, we thought it would be simplest to just add it to submit_image_query for now. If it ends up being more widely desired, it could eventually get added to the other

Okay, that makes sense. The part I was missing is that this governs the submission only; it's not a timeout for the whole function call. I think what you have in the docstring is fine.

@brandon-wada brandon-wada self-requested a review June 11, 2025 22:15
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.

Testing the SDK under different network conditions is going to be a bit of a trickier task to look into in the future. This looks good though

"""
with pytest.raises(ReadTimeoutError):
# Setting a very low request_timeout value should result in a timeout.
# NOTE: request_timeout=0 seems to have special behavior that does not result in a timeout.
Copy link
Collaborator

Choose a reason for hiding this comment

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

The urllib3 documentation is a little bit annoying about this, but the type on timeout is a float or None, so it wouldn't surprise me if there's some check on if timeout that falls back on some default wait time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmmm interesting, that definitely seems possible

@CoreyEWood CoreyEWood merged commit b54e39d into main Jun 11, 2025
15 of 16 checks passed
@CoreyEWood CoreyEWood deleted the submit-image-query-request-timeout branch June 11, 2025 23:18
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.

4 participants