Skip to content
This repository was archived by the owner on Jan 24, 2024. It is now read-only.

Commit be297f0

Browse files
authored
fea/only update better kpi (#24)
1 parent 07f0ec9 commit be297f0

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919

2020
tmp_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
2326
db_name = "ce"
2427
table_name = "logs"

main.xsh

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)