/ mlflow / entities / run_tag.py
run_tag.py
 1  from mlflow.entities._mlflow_object import _MlflowObject
 2  from mlflow.protos.service_pb2 import RunTag as ProtoRunTag
 3  
 4  
 5  class RunTag(_MlflowObject):
 6      """Tag object associated with a run."""
 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              # TODO deep equality here?
15              return self.__dict__ == other.__dict__
16          return False
17  
18      @property
19      def key(self):
20          """String name of the tag."""
21          return self._key
22  
23      @property
24      def value(self):
25          """String value of the tag."""
26          return self._value
27  
28      def to_proto(self):
29          param = ProtoRunTag()
30          param.key = self.key
31          param.value = self.value
32          return param
33  
34      @classmethod
35      def from_proto(cls, proto):
36          return cls(proto.key, proto.value)