11import concurrent .futures
2- from dataclasses import dataclass
2+ from dataclasses import (
3+ dataclass ,
4+ field ,
5+ )
36from datetime import (
47 datetime ,
58 timedelta ,
2326class GeneratedRun :
2427 custom_run_id : str
2528 experiment_name : str
26- fork_run_id : Union [str , None ]
27- fork_level : Optional [int ]
28- fork_point : Optional [int ]
29- configs : dict [AttributeName , Union [float , bool , int , str , datetime , list , set , tuple ]]
30- metrics : dict [AttributeName , dict [Step , Value ]]
31- tags : list [str ]
29+ fork_run_id : Union [str , None ] = None
30+ fork_level : Optional [int ] = None
31+ fork_point : Optional [int ] = None
32+ configs : dict [AttributeName , Union [float , bool , int , str , datetime , list , set , tuple ]] = field (default_factory = dict )
33+ metrics : dict [AttributeName , dict [Step , Value ]] = field (default_factory = dict )
34+ string_series : dict [AttributeName , dict [Step , str ]] = field (default_factory = dict )
35+ tags : list [str ] = field (default_factory = list )
3236
3337 def attributes (self ):
34- return set ().union (self .configs .keys (), self .metrics .keys ())
38+ return set ().union (self .configs .keys (), self .metrics .keys (), self . string_series . keys () )
3539
3640 def metrics_values (self , name : AttributeName ) -> list [tuple [Step , Value ]]:
3741 return list (self .metrics [name ].items ())
@@ -51,9 +55,6 @@ def metrics_values(self, name: AttributeName) -> list[tuple[Step, Value]]:
5155 GeneratedRun (
5256 custom_run_id = "linear_history_root" ,
5357 experiment_name = LINEAR_TREE_EXP_NAME ,
54- fork_level = None ,
55- fork_point = None ,
56- fork_run_id = None ,
5758 tags = ["linear_root" , "linear" ],
5859 configs = {
5960 "int-value" : 1 ,
@@ -127,9 +128,6 @@ def metrics_values(self, name: AttributeName) -> list[tuple[Step, Value]]:
127128 GeneratedRun (
128129 custom_run_id = "forked_history_root" ,
129130 experiment_name = FORKED_TREE_EXP_NAME ,
130- fork_level = None ,
131- fork_point = None ,
132- fork_run_id = None ,
133131 tags = ["forked_history_root" , "forked_history" ],
134132 configs = {
135133 "int-value" : 1 ,
@@ -186,7 +184,54 @@ def metrics_values(self, name: AttributeName) -> list[tuple[Step, Value]]:
186184 ),
187185]
188186
189- ALL_STATIC_RUNS = LINEAR_HISTORY_TREE + FORKED_HISTORY_TREE
187+ # Tree structure:
188+ #
189+ # multi_experiment_history:
190+ # root (level: None, experiment: exp_with_multi_experiment_history_1)
191+ # └── fork1 (level: 1, fork_point: 4, experiment: exp_with_multi_experiment_history_2)
192+ # └── fork2 (level: 2, fork_point: 8, experiment: exp_with_multi_experiment_history_2)
193+ MULT_EXPERIMENT_HISTORY_EXP_1 = "exp_with_multi_experiment_history_1"
194+ MULT_EXPERIMENT_HISTORY_EXP_2 = "exp_with_multi_experiment_history_2"
195+ MULTI_EXPERIMENT_HISTORY = [
196+ GeneratedRun (
197+ custom_run_id = "mult_exp_history_run_1" ,
198+ experiment_name = MULT_EXPERIMENT_HISTORY_EXP_1 ,
199+ metrics = {
200+ "metrics/m1" : {step : step * 0.1 for step in range (0 , 5 )},
201+ },
202+ string_series = {
203+ "string_series/s1" : {step : f"val_run1_{ step } " for step in range (0 , 5 )},
204+ },
205+ ),
206+ GeneratedRun (
207+ custom_run_id = "mult_exp_history_run_2" ,
208+ experiment_name = MULT_EXPERIMENT_HISTORY_EXP_2 ,
209+ fork_level = 1 ,
210+ fork_point = 4 ,
211+ fork_run_id = "mult_exp_history_run_1" ,
212+ metrics = {
213+ "metrics/m1" : {step : step * 0.2 for step in range (5 , 9 )},
214+ },
215+ string_series = {
216+ "string_series/s1" : {step : f"val_run2_{ step } " for step in range (5 , 9 )},
217+ },
218+ ),
219+ GeneratedRun (
220+ custom_run_id = "mult_exp_history_run_3" ,
221+ experiment_name = MULT_EXPERIMENT_HISTORY_EXP_2 ,
222+ fork_level = 2 ,
223+ fork_point = 8 ,
224+ fork_run_id = "mult_exp_history_run_2" ,
225+ metrics = {
226+ "metrics/m1" : {step : step * 0.3 for step in range (9 , 12 )},
227+ },
228+ string_series = {
229+ "string_series/s1" : {step : f"val_run3_{ step } " for step in range (9 , 12 )},
230+ },
231+ ),
232+ ]
233+
234+ ALL_STATIC_RUNS = LINEAR_HISTORY_TREE + FORKED_HISTORY_TREE + MULTI_EXPERIMENT_HISTORY
190235RUN_BY_ID = {run .custom_run_id : run for run in ALL_STATIC_RUNS }
191236
192237
@@ -209,6 +254,10 @@ def log_run(generated: GeneratedRun, api_token: str, e2e_alpha_project: str):
209254 for step , value in metric_values .items ():
210255 run .log_metrics (step = step , data = {metric_name : value }, timestamp = timestamp_for_step (step ))
211256
257+ for string_series_name , string_series_values in generated .string_series .items ():
258+ for step , value in string_series_values .items ():
259+ run .log_string_series (step = step , data = {string_series_name : value }, timestamp = timestamp_for_step (step ))
260+
212261
213262def log_runs (api_token : str , e2e_alpha_project : str , runs : list [GeneratedRun ]):
214263 max_level = max (run .fork_level or 0 for run in runs )
0 commit comments