Skip to content

Conversation

@dubininsergey
Copy link
Contributor

Validate metric names against the list of reserved ones

continue
metrics.append(
ScalarMetric(metric_name="iou", feature_name=key, value=value))
ScalarMetric(metric_name="custom_iou", feature_name=key, value=value))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

as we agreed in Slack discussion, we rename these to custom_iou

if name.lower().strip() in RESERVED_METRIC_NAMES:
raise ValueError(f"`{clean_name}` is a reserved metric name. "
"Please provide another value for `metric_name`.")
return clean_name
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we shouldn't force all lowercase, it's just for validation purpose

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we should be consistent, if we're validating against lower-cased value then we should store it that way as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

but on the other hand it will break existing metrics, yeah 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd say validating against lower-cased metric name feels weird, we should just trim it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

alright, I think that's not so important

now we return the source name as it's currently in prod version 👌

@validator('metric_name')
def validate_metric_name(cls, name: str):
clean_name = name.lower().strip()
if name.lower().strip() in RESERVED_METRIC_NAMES:
Copy link
Contributor

Choose a reason for hiding this comment

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

super nit, might want to change name.lower().strip() to clean_name

@dubininsergey dubininsergey merged commit 6df07ce into develop Nov 29, 2022
@dubininsergey dubininsergey deleted the sdubinin/al-4149 branch November 29, 2022 05:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants