Skip to content
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

Fixed Bulk Add DatumAlreadyExistsError and AnnotationAlreadyExistsError #643

Merged
merged 14 commits into from
Jul 3, 2024

Conversation

czaloom
Copy link
Collaborator

@czaloom czaloom commented Jul 1, 2024

Issue

The default timeout was 10s for all requests in the python client. For most requests this is fine, but for bulk add where a large JSON payload would have to be parsed by the API this would cause an early timeout.

This would have been caught earlier but the python client would perform automatic retrying of the POST request. This would immediately cause a conflict on the API-side as the already existing data was being uploaded.

Example

The following shows the same request being resent without the knowledge of the user. The "retry" immediately fails because it directly conflicts with the original request.

{"method": "POST", "path": "/predictions", "hostname": "0.0.0.0", "status": 200, "duration_ms": 12469.926136996946, ...
{"method": "POST", "path": "/predictions", "hostname": "0.0.0.0", "status": 409, "duration_ms": 557.2792300081346, ...

Solution

  • remove retrying client requests, this exposes the issue so the user can retry the command themselves.
  • expose timeout at the highest level so that it can be dynamically set by the user.

@czaloom czaloom marked this pull request as ready for review July 1, 2024 15:25
@czaloom czaloom requested review from ntlind and ekorman as code owners July 1, 2024 15:25
@@ -192,10 +192,9 @@ def _requests_wrapper(
method_name: str,
endpoint: str,
ignore_auth: bool = False,
max_retries_on_timeout=2,
initial_timeout: float = 2,
timeout: Optional[float] = 2,
Copy link
Contributor

@ntlind ntlind Jul 2, 2024

Choose a reason for hiding this comment

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

this is one of the reasons you'll see people use 0 or -1 to mean "don't use a timeout" instead of None

@@ -1458,6 +1471,7 @@ def create_predictions(
dataset: Dataset,
model: Model,
predictions: List[Prediction],
timeout: Optional[float] = None,
Copy link
Contributor

Choose a reason for hiding this comment

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

I didnt make the retry logic configurable, retrying for POST requests is completely removed.

take create_groundtruths: how is retrying for POST requests completely removed if the user can configure them with a timeout param?

@czaloom czaloom added bug Something isn't working and removed improvement labels Jul 3, 2024
client/valor/client.py Outdated Show resolved Hide resolved
@czaloom czaloom merged commit f98cc46 into main Jul 3, 2024
11 checks passed
@czaloom czaloom deleted the czaloom-639-bug-bulk-add-error branch July 3, 2024 18:59
@Striveworks Striveworks deleted a comment from czaloom Jul 11, 2024
@Striveworks Striveworks deleted a comment from czaloom Jul 11, 2024
@Striveworks Striveworks deleted a comment from czaloom Jul 11, 2024
@Striveworks Striveworks deleted a comment from czaloom Jul 11, 2024
@Striveworks Striveworks deleted a comment from czaloom Jul 11, 2024
@Striveworks Striveworks deleted a comment from czaloom Jul 11, 2024
@Striveworks Striveworks deleted a comment from czaloom Jul 11, 2024
@Striveworks Striveworks deleted a comment from czaloom Jul 11, 2024
@Striveworks Striveworks deleted a comment from czaloom Jul 11, 2024
@Striveworks Striveworks deleted a comment from czaloom Jul 11, 2024
@Striveworks Striveworks deleted a comment from czaloom Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: Bulk add_predictions fails with DatumAlreadyExistsError or AnnotationAlreadyExistsError
3 participants