Spaces:
Sleeping
Sleeping
Added cache self.leaderboard_heatmaps
Browse files
server.py
CHANGED
@@ -295,6 +295,7 @@ class LeaderboardServer:
|
|
295 |
self.tournament_dataframes = {} # For each submission_id and category
|
296 |
self.leaderboard_dataframes_csv = {} # For each category
|
297 |
self.tournament_dataframes_csv = {} # For each submission_id and category
|
|
|
298 |
|
299 |
self.results_dataset_local_snapshot_lock = ReadWriteLock()
|
300 |
self.results_dataset_local_snapshot = None
|
@@ -372,6 +373,14 @@ class LeaderboardServer:
|
|
372 |
with self.var_lock.rw:
|
373 |
self.leaderboard_dataframes_csv = leaderboard_dataframes_csv
|
374 |
self.tournament_dataframes_csv = tournament_dataframes_csv
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
375 |
|
376 |
def load_tournament_results(self):
|
377 |
with self.results_dataset_local_snapshot_lock.ro:
|
@@ -763,6 +772,15 @@ class LeaderboardServer:
|
|
763 |
return fig
|
764 |
|
765 |
def get_leaderboard_heatmap(self, pre_submit=None, category=None, kind_of_p_value=None):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
766 |
from analyze_winscore import get_ldb_records, create_heatmap
|
767 |
|
768 |
kind_of_p_value = kind_of_p_value if kind_of_p_value else self.DEFAULT_KIND_OF_P_VALUE
|
|
|
295 |
self.tournament_dataframes = {} # For each submission_id and category
|
296 |
self.leaderboard_dataframes_csv = {} # For each category
|
297 |
self.tournament_dataframes_csv = {} # For each submission_id and category
|
298 |
+
self.leaderboard_heatmaps = {} # For each category
|
299 |
|
300 |
self.results_dataset_local_snapshot_lock = ReadWriteLock()
|
301 |
self.results_dataset_local_snapshot = None
|
|
|
373 |
with self.var_lock.rw:
|
374 |
self.leaderboard_dataframes_csv = leaderboard_dataframes_csv
|
375 |
self.tournament_dataframes_csv = tournament_dataframes_csv
|
376 |
+
|
377 |
+
leaderboard_heatmaps = {kind_of_p_value: {
|
378 |
+
category: self._get_leaderboard_heatmap(category=category, kind_of_p_value=kind_of_p_value)
|
379 |
+
for category in categories
|
380 |
+
} for kind_of_p_value in self.KINDS_OF_P_VALUE}
|
381 |
+
|
382 |
+
with self.var_lock.rw:
|
383 |
+
self.leaderboard_heatmaps = leaderboard_heatmaps
|
384 |
|
385 |
def load_tournament_results(self):
|
386 |
with self.results_dataset_local_snapshot_lock.ro:
|
|
|
772 |
return fig
|
773 |
|
774 |
def get_leaderboard_heatmap(self, pre_submit=None, category=None, kind_of_p_value=None):
|
775 |
+
if pre_submit == None:
|
776 |
+
category = category if category else self.TASKS_CATEGORY_OVERALL
|
777 |
+
kind_of_p_value = kind_of_p_value if kind_of_p_value else self.DEFAULT_KIND_OF_P_VALUE
|
778 |
+
with self.var_lock.ro:
|
779 |
+
return self.leaderboard_heatmaps[kind_of_p_value][category]
|
780 |
+
else:
|
781 |
+
return self._get_leaderboard_heatmap(pre_submit=pre_submit, category=category, kind_of_p_value=kind_of_p_value)
|
782 |
+
|
783 |
+
def _get_leaderboard_heatmap(self, pre_submit=None, category=None, kind_of_p_value=None):
|
784 |
from analyze_winscore import get_ldb_records, create_heatmap
|
785 |
|
786 |
kind_of_p_value = kind_of_p_value if kind_of_p_value else self.DEFAULT_KIND_OF_P_VALUE
|