idolezal commited on
Commit
3b741bb
β€’
1 Parent(s): a6ec86d

Call update_leaderboard() after results_dataset_integrity_check()

Browse files
Files changed (1) hide show
  1. server.py +7 -4
server.py CHANGED
@@ -186,9 +186,9 @@ class LeaderboardServer:
186
  self.submission_id_to_model_title = {}
187
  self.submission_id_to_data = {} # Only data (results and metadata) using by leaderboard
188
  self.tournament_results = None
 
189
  self.leaderboard_dataframes = {} # For each category
190
  self.tournament_dataframes = {} # For each submission_id and category
191
-
192
  self.leaderboard_dataframes_csv = {} # For each category
193
  self.tournament_dataframes_csv = {} # For each submission_id and category
194
 
@@ -198,10 +198,10 @@ class LeaderboardServer:
198
  self.pre_submit_lock = pre_submit_lock
199
  self.pre_submit = None
200
 
201
- self.update_leaderboard()
202
  self.results_dataset_integrity_check() # Check integrity of the results dataset after (re)start Hugging Face Space
 
203
 
204
- def update_leaderboard(self):
205
  with self.results_dataset_local_snapshot_lock.rw:
206
  self.results_dataset_local_snapshot = snapshot_download(
207
  self.SERVER_ADDRESS,
@@ -215,6 +215,9 @@ class LeaderboardServer:
215
  tournament_results = self.load_tournament_results()
216
  with self.var_lock.rw:
217
  self.tournament_results = tournament_results
 
 
 
218
 
219
  categories = [self.TASKS_CATEGORY_OVERALL] + sorted(self.TASKS_CATEGORIES)
220
 
@@ -335,7 +338,7 @@ class LeaderboardServer:
335
  with self.pre_submit_lock(timeout=5) as acquired:
336
  if acquired and self.pre_submit == None:
337
  gr.Info('Checking integrity...', duration=15)
338
- self.update_leaderboard()
339
 
340
  with self.var_lock.ro:
341
  # Is every `submission_id` in results known?
 
186
  self.submission_id_to_model_title = {}
187
  self.submission_id_to_data = {} # Only data (results and metadata) using by leaderboard
188
  self.tournament_results = None
189
+
190
  self.leaderboard_dataframes = {} # For each category
191
  self.tournament_dataframes = {} # For each submission_id and category
 
192
  self.leaderboard_dataframes_csv = {} # For each category
193
  self.tournament_dataframes_csv = {} # For each submission_id and category
194
 
 
198
  self.pre_submit_lock = pre_submit_lock
199
  self.pre_submit = None
200
 
 
201
  self.results_dataset_integrity_check() # Check integrity of the results dataset after (re)start Hugging Face Space
202
+ self.update_leaderboard()
203
 
204
+ def _update_models_and_tournament_results(self):
205
  with self.results_dataset_local_snapshot_lock.rw:
206
  self.results_dataset_local_snapshot = snapshot_download(
207
  self.SERVER_ADDRESS,
 
215
  tournament_results = self.load_tournament_results()
216
  with self.var_lock.rw:
217
  self.tournament_results = tournament_results
218
+
219
+ def update_leaderboard(self):
220
+ self._update_models_and_tournament_results()
221
 
222
  categories = [self.TASKS_CATEGORY_OVERALL] + sorted(self.TASKS_CATEGORIES)
223
 
 
338
  with self.pre_submit_lock(timeout=5) as acquired:
339
  if acquired and self.pre_submit == None:
340
  gr.Info('Checking integrity...', duration=15)
341
+ self._update_models_and_tournament_results()
342
 
343
  with self.var_lock.ro:
344
  # Is every `submission_id` in results known?