-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Raise an exception only if param value changed #8038
Raise an exception only if param value changed #8038
Conversation
Signed-off-by: Adam Stelmaszczyk <stelmaszczykadam@gmail.com>
Documentation preview for 4d1653d will be available here when this CircleCI job completes successfully. More info
|
@AdamStelmaszczyk Thanks for the PR! Can you add a test? |
Unfortunately, I don't know how to test this with 100% repeatability to have an automatic test. One needs at least 2 threads performing DB inserts in exactly same time, so it's probabilistic. That's why I wrote client.py which shows the bug (exception thrown) let's say ~80% of time. So with manual testing it's fine, one can try several times client.py - but it doesn't seem suitable for an automatic test. |
@AdamStelmaszczyk Understood, thanks for the explanation! I thought just logging the same parameter twice can reproduce the issue, but concurrent write is needed to reproduce. I was able to reproduce the issue using the attached code. |
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.
LGTM!
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.
LGTM! Thanks @AdamStelmaszczyk !
Signed-off-by: Adam Stelmaszczyk <stelmaszczykadam@gmail.com>
Related Issues/PRs
Similar PR, but for _log_params: #7057
What changes are proposed in this pull request?
MlflowException("Changing param values is not allowed..."
shouldn't be raised if the values didn't change - but that wasn't the case as this was not checked. The change is adding anif
statement checking whether the param value actually changed.How is this patch tested?
To reproduce the issue, create the client.py file:
Let's also create a venv:
And run the server in that venv:
Keep that console tab open. In a new one, run client.py in our venv:
After some time you should see INVALID_PARAMETER_VALUE exception. If not, re-run the script. Usually it takes only a couple of runs to trigger the exception.
After applying the proposed patch, you won't see the exception.
In our system, log_param was called from kedro pipeline, specifically https://github.com/Galileo-Galilei/kedro-mlflow calls it in before_node_run hook. So sometimes we saw the whole pipeline failing because of INVALID_PARAMETER_VALUE (and param values didn't change).
The logic now will be consistent with _log_params (that log_batch calls): https://github.com/AdamStelmaszczyk/mlflow/blob/4d1653da42c33ee9e89af7ec649bd2498895377a/mlflow/store/tracking/sqlalchemy_store.py#L983 which was fixed in #7057.
Does this PR change the documentation?
Release Notes
Is this a user-facing change?
SqlAlchemyStore.log_param() can now be called multiple times (and from multiple threads) with the same param values.
What component(s), interfaces, languages, and integrations does this PR affect?
Components
area/artifacts
: Artifact stores and artifact loggingarea/build
: Build and test infrastructure for MLflowarea/docs
: MLflow documentation pagesarea/examples
: Example codearea/model-registry
: Model Registry service, APIs, and the fluent client calls for Model Registryarea/models
: MLmodel format, model serialization/deserialization, flavorsarea/recipes
: Recipes, Recipe APIs, Recipe configs, Recipe Templatesarea/projects
: MLproject format, project running backendsarea/scoring
: MLflow Model server, model deployment tools, Spark UDFsarea/server-infra
: MLflow Tracking server backendarea/tracking
: Tracking Service, tracking client APIs, autologgingInterface
area/uiux
: Front-end, user experience, plotting, JavaScript, JavaScript dev serverarea/docker
: Docker use across MLflow's components, such as MLflow Projects and MLflow Modelsarea/sqlalchemy
: Use of SQLAlchemy in the Tracking Service or Model Registryarea/windows
: Windows supportLanguage
language/r
: R APIs and clientslanguage/java
: Java APIs and clientslanguage/new
: Proposals for new client languagesIntegrations
integrations/azure
: Azure and Azure ML integrationsintegrations/sagemaker
: SageMaker integrationsintegrations/databricks
: Databricks integrationsHow should the PR be classified in the release notes? Choose one:
rn/breaking-change
- The PR will be mentioned in the "Breaking Changes" sectionrn/none
- No description will be included. The PR will be mentioned only by the PR number in the "Small Bugfixes and Documentation Updates" sectionrn/feature
- A new user-facing feature worth mentioning in the release notesrn/bug-fix
- A user-facing bug fix worth mentioning in the release notesrn/documentation
- A user-facing documentation change worth mentioning in the release notes