KUAN-HSUN-LI commented on a change in pull request #752:
URL: https://github.com/apache/submarine/pull/752#discussion_r713236288
##########
File path: submarine-sdk/pysubmarine/submarine/utils/validation.py
##########
@@ -116,8 +117,48 @@ def validate_param(key, value):
_validate_length_limit("Param value", MAX_PARAM_VAL_LENGTH, str(value))
+def validate_tags(tags: Optional[List[str]]) -> None:
+ if tags is not None and not isinstance(tags, list):
+ raise SubmarineException("parameter tags must be list or None.")
+ for tag in tags or []:
+ validate_tag(tag)
+
+
+def validate_tag(tag: str) -> None:
+ """Check that `tag` is a valid tag value and raise an exception if it
isn't."""
+ # Reuse param & metric check.
+ if tag is None or tag == "":
+ raise SubmarineException("Tag cannot be empty.")
+ if not _VALID_PARAM_AND_METRIC_NAMES.match(tag):
+ raise SubmarineException("Invalid tag name: '%s'. %s" % (tag,
_BAD_CHARACTERS_MESSAGE))
+
+
+def validate_model_name(model_name: str) -> None:
+ if model_name is None or model_name == "":
+ raise SubmarineException("Registered model name cannot be empty.")
+
+
+def validate_model_version(model_version: int) -> None:
Review comment:
I think this function name is fine.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]