Skip to content
This repository was archived by the owner on Apr 15, 2022. It is now read-only.

Commit 1b42648

Browse files
author
Epstein
authored
check param length (#64)
1 parent 29d0ed2 commit 1b42648

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

splicemachine/mlflow_support/mlflow_support.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,18 +122,24 @@ def _lp(key, value):
122122
:param key: key for the parameter
123123
:param value: value for the parameter
124124
"""
125+
if len(str(value)) > 250 or len(str(key)) > 250:
126+
raise SpliceMachineException(f'It seems your parameter input is too long. The max length is 250 characters.'
127+
f'Your key is length {len(str(key))} and your value is length {len(str(value))}.')
125128
mlflow.log_param(key, value)
126129

127130

128131
@_mlflow_patch('lm')
129-
def _lm(key, value):
132+
def _lm(key, value, step=None):
130133
"""
131134
Add a shortcut for logging metrics in MLFlow.
132135
Accessible from mlflow.lm
133136
:param key: key for the parameter
134137
:param value: value for the parameter
135138
"""
136-
mlflow.log_metric(key, value)
139+
if len(str(key)) > 250:
140+
raise SpliceMachineException(f'It seems your metric key is too long. The max length is 250 characters,'
141+
f'but yours is {len(str(key))}')
142+
mlflow.log_metric(key, value, step=step)
137143

138144

139145
@_mlflow_patch('log_model')

0 commit comments

Comments
 (0)