idolezal commited on
Commit
61e97bd
1 Parent(s): b9c54a7

Create new `self.tournament_results` more effectively

Browse files
Files changed (1) hide show
  1. server.py +5 -2
server.py CHANGED
@@ -259,13 +259,16 @@ class LeaderboardServer:
259
 
260
  gr.Info('Running tournament...', duration=15)
261
  with self.var_lock.rw:
262
- self.tournament_results = {k: {} for k in self.submission_ids}
263
- for submission_id in self.submission_ids:
 
 
264
  with self.var_lock.ro:
265
  file = self.submission_id_to_file[submission_id]
266
  tournament_results = self.start_tournament(submission_id, file)
267
  with self.var_lock.rw:
268
  self.tournament_results = tournament_results
 
269
 
270
  gr.Info('Uploading tournament results...', duration=5)
271
  if self.tournament_results:
 
259
 
260
  gr.Info('Running tournament...', duration=15)
261
  with self.var_lock.rw:
262
+ self.tournament_results = {}
263
+ submission_ids_backup = self.submission_ids
264
+ self.submission_ids = set()
265
+ for submission_id in submission_ids_backup:
266
  with self.var_lock.ro:
267
  file = self.submission_id_to_file[submission_id]
268
  tournament_results = self.start_tournament(submission_id, file)
269
  with self.var_lock.rw:
270
  self.tournament_results = tournament_results
271
+ self.submission_ids.add(submission_id)
272
 
273
  gr.Info('Uploading tournament results...', duration=5)
274
  if self.tournament_results: