Skip to content

Commit

Permalink
Validate metric key length in _validate_metric (mlflow#11209)
Browse files Browse the repository at this point in the history
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
Signed-off-by: Arthur Jenoudet <arthur.jenoudet@databricks.com>
  • Loading branch information
harupy authored and artjen committed Mar 26, 2024
1 parent 22c094c commit 631e516
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions mlflow/utils/validation.py
Expand Up @@ -163,6 +163,8 @@ def _validate_metric(key, value, timestamp, step):
INVALID_PARAMETER_VALUE,
)

_validate_length_limit("Metric name", MAX_ENTITY_KEY_LENGTH, key)


def _validate_param(key, value):
"""
Expand Down Expand Up @@ -315,12 +317,6 @@ def _validate_batch_log_limits(metrics, params, tags):
def _validate_batch_log_data(metrics, params, tags):
for metric in metrics:
_validate_metric(metric.key, metric.value, metric.timestamp, metric.step)
# TODO: move _validate_length_limit calls into _validate_metric etc. This would be a
# breaking change as _validate_metric is also used in the single-entry log_metric API. Thus
# we defer it for now to allow for a release of the batched logging APIs without breaking
# changes to other APIs. See related discussion in
# https://github.com/mlflow/mlflow/issues/985
_validate_length_limit("Metric name", MAX_ENTITY_KEY_LENGTH, metric.key)
for param in params:
_validate_param(param.key, param.value)
for tag in tags:
Expand Down

0 comments on commit 631e516

Please sign in to comment.