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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add backoff jitter #10486

Merged
merged 10 commits into from Nov 24, 2023
Merged

Add backoff jitter #10486

merged 10 commits into from Nov 24, 2023

Conversation

ajinkyavbhandare
Copy link
Contributor

@ajinkyavbhandare ajinkyavbhandare commented Nov 22, 2023

馃洜 DevTools 馃洜

Open in GitHub Codespaces

Install mlflow from this PR

pip install git+https://github.com/mlflow/mlflow.git@refs/pull/10486/merge

Checkout with GitHub CLI

gh pr checkout 10486

Related Issues/PRs

Resolve #10482

What changes are proposed in this pull request?

This PR adds a backoff jitter to HTTP requests in MLflow. This is achieved by introducing a new environment variable MLFLOW_HTTP_REQUEST_BACKOFF_JITTER and using this variable when making HTTP requests.

How is this PR tested?

  • Existing unit/integration tests
  • New unit/integration tests
  • Manual tests

Does this PR require documentation update?

  • No. You can skip the rest of this section.
  • Yes. I've updated:
    • Examples
    • API references
    • Instructions

Release Notes

Is this a user-facing change?

  • No. You can skip the rest of this section.
  • Yes. Give a description of this change to be included in the release notes for MLflow users.

Yes. This change introduces a backoff jitter to HTTP requests, which can help improve the efficiency and reliability of the requests.

What component(s), interfaces, languages, and integrations does this PR affect?

Components

  • area/artifacts: Artifact stores and artifact logging
  • area/build: Build and test infrastructure for MLflow
  • area/docs: MLflow documentation pages
  • area/examples: Example code
  • area/gateway: AI Gateway service, Gateway client APIs, third-party Gateway integrations
  • area/model-registry: Model Registry service, APIs, and the fluent client calls for Model Registry
  • area/models: MLmodel format, model serialization/deserialization, flavors
  • area/recipes: Recipes, Recipe APIs, Recipe configs, Recipe Templates
  • area/projects: MLproject format, project running backends
  • area/scoring: MLflow Model server, model deployment tools, Spark UDFs
  • area/server-infra: MLflow Tracking server backend
  • area/tracking: Tracking Service, tracking client APIs, autologging

Interface

  • area/uiux: Front-end, user experience, plotting, JavaScript, JavaScript dev server
  • area/docker: Docker use across MLflow's components, such as MLflow Projects and MLflow Models
  • area/sqlalchemy: Use of SQLAlchemy in the Tracking Service or Model Registry
  • area/windows: Windows support

Language

  • language/r: R APIs and clients
  • language/java: Java APIs and clients
  • language/new: Proposals for new client languages

Integrations

  • integrations/azure: Azure and Azure ML integrations
  • integrations/sagemaker: SageMaker integrations
  • integrations/databricks: Databricks integrations

How should the PR be classified in the release notes? Choose one:

  • rn/none - No description will be included. The PR will be mentioned only by the PR number in the "Small Bugfixes and Documentation Updates" section
  • rn/breaking-change - The PR will be mentioned in the "Breaking Changes" section
  • rn/feature - A new user-facing feature worth mentioning in the release notes
  • rn/bug-fix - A user-facing bug fix worth mentioning in the release notes
  • rn/documentation - A user-facing documentation change worth mentioning in the release notes

Signed-off-by: Ajinkya Bhandare <112012663+ajinkyavbhandare@users.noreply.github.com>
Signed-off-by: Ajinkya Bhandare <112012663+ajinkyavbhandare@users.noreply.github.com>
Copy link

github-actions bot commented Nov 22, 2023

Documentation preview for 33fcf70 will be available here when this CircleCI job completes successfully.

More info

@github-actions github-actions bot added area/server-infra MLflow Tracking server backend rn/feature Mention under Features in Changelogs. labels Nov 22, 2023
Signed-off-by: Ajinkya Bhandare <112012663+ajinkyavbhandare@users.noreply.github.com>
@harupy
Copy link
Member

harupy commented Nov 22, 2023

@ajinkyavbhandare why you closed it?

@ajinkyavbhandare
Copy link
Contributor Author

hello @harupy ,I made some changes to the code for the and created a new pull request, #10486. Could you please review the new pull request and reassign me the task? thank you.

@harupy
Copy link
Member

harupy commented Nov 22, 2023

where is the new PR?

@ajinkyavbhandare ajinkyavbhandare mentioned this pull request Nov 22, 2023
37 tasks
@harupy
Copy link
Member

harupy commented Nov 22, 2023

@ajinkyavbhandare what's the difference?

@harupy harupy reopened this Nov 22, 2023
@harupy
Copy link
Member

harupy commented Nov 22, 2023

we can keep working on this one.

@harupy
Copy link
Member

harupy commented Nov 22, 2023

let me push a commit.

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
Comment on lines -63 to +65
max_retries = max_retries or MLFLOW_HTTP_REQUEST_MAX_RETRIES.get()
backoff_factor = backoff_factor or MLFLOW_HTTP_REQUEST_BACKOFF_FACTOR.get()
timeout = timeout or MLFLOW_HTTP_REQUEST_TIMEOUT.get()
max_retries = MLFLOW_HTTP_REQUEST_MAX_RETRIES.get() if max_retries is None else max_retries
Copy link
Member

@harupy harupy Nov 22, 2023

Choose a reason for hiding this comment

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

In the original code, max_retries = 0 defaults to MLFLOW_HTTP_REQUEST_MAX_RETRIES.get() but it should not.

Copy link
Member

@harupy harupy left a comment

Choose a reason for hiding this comment

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

LGTM

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
@mlflow mlflow deleted a comment from mlflow bot Nov 22, 2023
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
@harupy
Copy link
Member

harupy commented Nov 24, 2023

Manually tested using this toy fastapi app:

from fastapi import FastAPI, HTTPException, status


app = FastAPI()


counter = 0


@app.get("/test")
def test():
    global counter
    counter += 1

    if counter < 3:
        raise HTTPException(
            status_code=status.HTTP_502_BAD_GATEWAY,
            detail="Service unavailable",
        )

    else:
        # Reset counter
        counter = 0
        return {"counter": counter}


# Command to run this app using uvicorn:
# uvicorn app:app --reload --port 8000

@harupy harupy merged commit ddfeea6 into mlflow:master Nov 24, 2023
35 checks passed
@harupy
Copy link
Member

harupy commented Nov 24, 2023

@ajinkyavbhandare Thanks for the contribution!

@ajinkyavbhandare
Copy link
Contributor Author

@harupy Thank you , I'm grateful for the opportunity to be a part of this project.

KonakanchiSwathi pushed a commit to KonakanchiSwathi/mlflow that referenced this pull request Nov 29, 2023
Signed-off-by: Ajinkya Bhandare <112012663+ajinkyavbhandare@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
Co-authored-by: harupy <17039389+harupy@users.noreply.github.com>
Signed-off-by: swathi <konakanchi.swathi@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/server-infra MLflow Tracking server backend fail-fast rn/feature Mention under Features in Changelogs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use backoff_jitter when making HTTP requests
3 participants