@@ -97,15 +97,13 @@ def run(
9797 name : str | None = None ,
9898 description : str | None = None ,
9999 meta : dict | None = None ,
100- labels : dict | None = None ,
101100 ):
102101 """
103102 :param project_id: the project ID to run the experiment under
104103 :param name: the name of the experiment. If not provided,
105104 a UUID will be generated.
106105 :param description: the description of the experiment
107106 :param meta: the metadata of the experiment
108- :param labels: the labels of the experiment
109107 :param artifact_insecure: whether to use insecure connection to the
110108 artifact registry. Default is False.
111109
@@ -114,15 +112,17 @@ def run(
114112
115113 exp = Experiment (config = config )
116114 return RunContext (
117- exp , name = name , description = description , meta = meta , labels = labels
115+ exp ,
116+ name = name ,
117+ description = description ,
118+ meta = meta ,
118119 )
119120
120121 def create (
121122 self ,
122123 name : str ,
123124 description : str | None = None ,
124125 meta : dict | None = None ,
125- labels : dict | None = None ,
126126 status : ExperimentStatus = ExperimentStatus .PENDING ,
127127 ) -> int :
128128 """
@@ -135,7 +135,6 @@ def create(
135135 description = description ,
136136 project_id = self ._runtime ._project_id ,
137137 meta = meta ,
138- labels = labels ,
139138 status = status ,
140139 )
141140
@@ -162,24 +161,29 @@ def delete(self, exp_id: int):
162161 self ._runtime ._metadb .delete_exp (exp_id = exp_id )
163162 self ._artifact .delete (experiment_name = exp .name , versions = tags )
164163
165- # Please provide all the labels to update, or it will overwrite the existing labels.
166- def update_labels (self , exp_id : int , labels : dict ):
167- self ._runtime ._metadb .update_exp (exp_id = exp_id , labels = labels )
164+ # Please provide all the tags to update, or it will overwrite the existing tags.
165+ def update_tags (self , exp_id : int , tags : dict ):
166+ exp = self .get (exp_id )
167+ if exp is None :
168+ return
169+
170+ if exp .meta is None :
171+ exp .meta = {}
172+
173+ exp .meta ["tags" ] = tags
174+ self ._runtime ._metadb .update_exp (exp_id = exp_id , meta = exp .meta )
168175
169- # start with save the
170176 def _start (
171177 self ,
172178 name : str | None = None ,
173179 description : str | None = None ,
174180 meta : dict | None = None ,
175- labels : dict | None = None ,
176181 ) -> int :
177182 """
178183 :param name: the name of the experiment. If not provided,
179184 a UUID will be generated.
180185 :param description: the description of the experiment
181186 :param meta: the metadata of the experiment
182- :param labels: the labels of the experiment
183187
184188 :return: the experiment ID
185189 """
@@ -191,8 +195,7 @@ def _start(
191195 name = name ,
192196 description = description ,
193197 meta = meta ,
194- labels = labels ,
195- status = ExperimentStatus .RUNNING
198+ status = ExperimentStatus .RUNNING ,
196199 )
197200
198201 return exp_id
@@ -226,20 +229,17 @@ def __init__(
226229 name : str | None = None ,
227230 description : str | None = None ,
228231 meta : dict | None = None ,
229- labels : dict | None = None ,
230232 ):
231233 self ._experiment = experiment
232234 self ._exp_name = name
233235 self ._description = description
234236 self ._meta = meta
235- self ._labels = labels
236237
237238 def __enter__ (self ):
238239 exp_id = self ._experiment ._start (
239240 name = self ._exp_name ,
240241 description = self ._description ,
241242 meta = self ._meta ,
242- labels = self ._labels ,
243243 )
244244
245245 # Set the current experiment ID in the runtime
0 commit comments