question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Log_params seems to not use the correct maximum length of value

See original GitHub issue

Willingness to contribute

Yes. I would be willing to contribute a fix for this bug with guidance from the MLflow community.

MLflow version

1.27.0

System information

  • OS Platform and Distribution MacOS 12.1:
  • Python version 3.8.13:

Describe the problem

log_params seems to use different validation logic for max. parameter value length compared to log_param. According to doc, parameter value should support length up to 5000 but in fact 250 limit seems to be there. This passes:

some_params= {'p': [float(c) for c in range(int(45))]}
mlflow.log_param('p', some_params['p'])

But the same parameter logged with log_params will cause error

mlflow.log_params(some_params)

Tracking information

MLflow version: 1.27.0
Tracking URI: file:///***/mlflow-bug/mlruns
Artifact URI: file:///***/mlflow-bug/mlruns/0/726fe0e42d564b7a93e395cb81fa593f/artifacts

Code to reproduce issue

import mlflow

print("MLflow version:", mlflow.__version__)
print("Tracking URI:", mlflow.get_tracking_uri())
print("Artifact URI:", mlflow.get_artifact_uri())
r=45
some_params= {'p': [float(c) for c in range(int(r))]}
print("Length of stringified param", len((str(some_params['p']))))

mlflow.end_run()
with mlflow.start_run(experiment_id='0'):
    rid2 = mlflow.active_run().info.run_id
    mlflow.log_params(some_params)

Other info / logs

Traceback (most recent call last):
  File "repro_mini.py", line 13, in <module>
    mlflow.log_params(some_params)
  File "/Users/jan.sindlar/Library/Caches/pypoetry/virtualenvs/mlflow-bug-ZZrSkkBy-py3.8/lib/python3.8/site-packages/mlflow/tracking/fluent.py", line 675, in log_params
    MlflowClient().log_batch(run_id=run_id, metrics=[], params=params_arr, tags=[])
  File "/Users/jan.sindlar/Library/Caches/pypoetry/virtualenvs/mlflow-bug-ZZrSkkBy-py3.8/lib/python3.8/site-packages/mlflow/tracking/client.py", line 918, in log_batch
    self._tracking_client.log_batch(run_id, metrics, params, tags)
  File "/Users/jan.sindlar/Library/Caches/pypoetry/virtualenvs/mlflow-bug-ZZrSkkBy-py3.8/lib/python3.8/site-packages/mlflow/tracking/_tracking_service/client.py", line 315, in log_batch
    self.store.log_batch(
  File "/Users/jan.sindlar/Library/Caches/pypoetry/virtualenvs/mlflow-bug-ZZrSkkBy-py3.8/lib/python3.8/site-packages/mlflow/store/tracking/file_store.py", line 883, in log_batch
    _validate_batch_log_data(metrics, params, tags)
  File "/Users/jan.sindlar/Library/Caches/pypoetry/virtualenvs/mlflow-bug-ZZrSkkBy-py3.8/lib/python3.8/site-packages/mlflow/utils/validation.py", line 320, in _validate_batch_log_data
    _validate_param(param.key, param.value)
  File "/Users/jan.sindlar/Library/Caches/pypoetry/virtualenvs/mlflow-bug-ZZrSkkBy-py3.8/lib/python3.8/site-packages/mlflow/utils/validation.py", line 148, in _validate_param
    _validate_length_limit("Param value", MAX_PARAM_VAL_LENGTH, value)
  File "/Users/jan.sindlar/Library/Caches/pypoetry/virtualenvs/mlflow-bug-ZZrSkkBy-py3.8/lib/python3.8/site-packages/mlflow/utils/validation.py", line 268, in _validate_length_limit
    raise MlflowException(
mlflow.exceptions.MlflowException: Param value '[0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0, 28.0, 29.0, 30.0, 31.0, 32.0, 33.0, 34.0, 35.0, 36.0, 37.0, 38.0, 39.0, 40.0, 41.0, 42.0, 4' had length 260, which exceeded length limit of 250

What component(s) does this bug affect?

  • 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/model-registry: Model Registry service, APIs, and the fluent client calls for Model Registry
  • area/models: MLmodel format, model serialization/deserialization, flavors
  • area/pipelines: Pipelines, Pipeline APIs, Pipeline configs, Pipeline 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

What interface(s) does this bug affect?

  • 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

What language(s) does this bug affect?

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

What integration(s) does this bug affect?

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

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:18 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
harupycommented, Jul 28, 2022

@johnyNJ Please let us know if you need help with migration.

0reactions
harupycommented, Jul 27, 2022
diff --git a/mlflow/store/tracking/dbmodels/models.py b/mlflow/store/tracking/dbmodels/models.py
index 20979681f..dd23e764f 100644
--- a/mlflow/store/tracking/dbmodels/models.py
+++ b/mlflow/store/tracking/dbmodels/models.py
@@ -407,7 +407,7 @@ class SqlParam(Base):
     """
     Param key: `String` (limit 250 characters). Part of *Primary Key* for ``params`` table.
     """
-    value = Column(String(250), nullable=False)
+    value = Column(String(500), nullable=False)
     """
     Param value: `String` (limit 250 characters). Defined as *Non-null* in schema.
     """

Just changing String(250) to String(500) doesn’t update the DB schema.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Value too long for field: Source maximum length is:131072 for ...
Hi, I'm using a complex LWC component where I'm using multiple tables. Because of that the storage limit is getting exceeded and I'm...
Read more >
'The specified value did not conform to the maximum length ...
I just ran a test in our SCSM 2012 SP1 environment (no modification to the Incident class, default Description property):. Using the SCSM ......
Read more >
Anomalies in JavaScript arrow functions - LogRocket Blog
Arrow functions can never be used as constructor functions. Hence, they can never be invoked with the new keyword. As such, a prototype...
Read more >
git-log Documentation - Git
limits only commits, and doesn't limit diff for those commits. ... --log-size ... It is an error to use this option unless --walk-reflogs...
Read more >
File Name value exceeds maximum length of 201 characters ...
Solved: Hi i am in new in SAS and try to extract the below dataset in Excel using the code below. However, i...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found