This repository was archived by the owner on Jan 24, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change 1919
2020tmp_root = pjoin (workspace , "tmp" )
2121
22+ # if the latest kpi is better than best kpi by 1%, update the best kpi.
23+ kpi_update_threshold = 0.01
24+
2225# mongodb config
2326db_name = "ce"
2427table_name = "logs"
Original file line number Diff line number Diff line change @@ -41,8 +41,21 @@ def update_baseline():
4141 cd @(task_dir )
4242 print ('task_dir' , task_dir )
4343 if os .path .isdir ('latest_kpis' ):
44- print ('coping' )
45- cp * _factor .txt latest_kpis /
44+ # update baseline if the latest kpi is better than history
45+ with PathRecover ():
46+ cd @(config .workspace )
47+ env = {}
48+ exec ('from tasks.%s.continuous_evaluation import tracking_kpis'
49+ % task_name , env )
50+ tracking_kpis = env ['tracking_kpis' ]
51+
52+ for kpi in tracking_kpis :
53+ kpi .root = task_dir
54+ better_ratio = kpi .compare_with (kpi .cur_data , kpi .baseline_data )
55+ if better_ratio > config .kpi_update_threshold :
56+ log .warn ('current kpi %s better than history by %f, update baseline' % (kpi .out_file , better_ratio ))
57+ cp @(kpi .out_file ) @(kpi .his_file )
58+
4659 git commit - a - m @(message )
4760 git push
4861
You can’t perform that action at this time.
0 commit comments