idolezal commited on
Commit
f69c211
1 Parent(s): 3d0b427

Basic implementation of `results_dataset_integrity_check()`

Browse files
Files changed (1) hide show
  1. server.py +44 -1
server.py CHANGED
@@ -227,7 +227,50 @@ class LeaderboardServer:
227
  -- kontroluje soubory v adresáři "/data" a soubor "tournament.json"
228
  - v souboru "tournament.json" není `submission_id`, které by nemělo soubor v adresáři "/data"
229
  """
230
- pass # TODO: results_dataset_integrity_check()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
231
 
232
  @staticmethod
233
  def _model_tournament_table_highlight_true_and_false(x):
 
227
  -- kontroluje soubory v adresáři "/data" a soubor "tournament.json"
228
  - v souboru "tournament.json" není `submission_id`, které by nemělo soubor v adresáři "/data"
229
  """
230
+
231
+ while True:
232
+ with self.pre_submit_lock:
233
+ if self.pre_submit == None:
234
+ gr.Info('Checking integrity...', duration=15)
235
+ self.update_leaderboard()
236
+
237
+ with self.var_lock.ro:
238
+ # Is every `submission_id` in results known?
239
+ if self.tournament_results.keys() - self.submission_ids != set():
240
+ pass
241
+ # Was every `submission_id` in some match?
242
+ elif self.submission_ids - self.tournament_results.keys() != set():
243
+ pass
244
+ # Are all competitors known?
245
+ elif any(
246
+ self.tournament_results[submission_id].keys() - self.submission_ids != set()
247
+ for submission_id in self.submission_ids
248
+ ):
249
+ pass
250
+ # Has had every `submission_id` match with all competitors?
251
+ elif any(
252
+ self.submission_ids - self.tournament_results[submission_id].keys() != set()
253
+ for submission_id in self.submission_ids
254
+ ):
255
+ pass
256
+ else:
257
+ break
258
+
259
+ gr.Info('Running tournament...', duration=15)
260
+ with self.var_lock.rw:
261
+ self.tournament_results = {}
262
+ for submission_id in self.submission_ids:
263
+ with self.var_lock.ro:
264
+ file = self.submission_id_to_file[submission_id]
265
+ tournament_results = self.start_tournament(submission_id, file)
266
+ with self.var_lock.rw:
267
+ self.tournament_results = tournament_results
268
+
269
+ if self.tournament_results:
270
+ self._upload_tournament_results(self.tournament_results)
271
+ break
272
+ gr.Info("Waiting in queue...", duration=5)
273
+ time.sleep(10)
274
 
275
  @staticmethod
276
  def _model_tournament_table_highlight_true_and_false(x):