experiment_tag.py
1 from mlflow.entities._mlflow_object import _MlflowObject 2 from mlflow.protos.service_pb2 import ExperimentTag as ProtoExperimentTag 3 4 5 class ExperimentTag(_MlflowObject): 6 """Tag object associated with an experiment.""" 7 8 def __init__(self, key, value): 9 self._key = key 10 self._value = value 11 12 def __eq__(self, other): 13 if type(other) is type(self): 14 return self.__dict__ == other.__dict__ 15 return False 16 17 @property 18 def key(self): 19 """String name of the tag.""" 20 return self._key 21 22 @property 23 def value(self): 24 """String value of the tag.""" 25 return self._value 26 27 def to_proto(self): 28 param = ProtoExperimentTag() 29 param.key = self.key 30 param.value = self.value 31 return param 32 33 @classmethod 34 def from_proto(cls, proto): 35 return cls(proto.key, proto.value)