Spaces:
Running
Running
Reduced processing in the critical section
Browse files
server.py
CHANGED
@@ -811,10 +811,10 @@ class LeaderboardServer:
|
|
811 |
|
812 |
competitor_ids_in_tournament = new_tournament[new_submission_id].keys()
|
813 |
rest_of_competitors = list(self.submission_ids - {new_submission_id} - competitor_ids_in_tournament) # without self and without the opponents with which it has already contended
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
|
819 |
return new_tournament
|
820 |
|
@@ -842,38 +842,38 @@ class LeaderboardServer:
|
|
842 |
competitor_ids_in_tournament = new_tournament[new_submission_id].keys()
|
843 |
rest_of_competitors = list(self.submission_ids - {new_submission_id} - competitor_ids_in_tournament) # without self and without the opponents with which it has already contended
|
844 |
num_of_competitors = len(rest_of_competitors)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
845 |
|
846 |
-
|
847 |
-
|
|
|
848 |
|
849 |
-
while
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
next_competitors.append(rest_of_competitors.pop())
|
854 |
-
else:
|
855 |
-
break
|
856 |
|
857 |
-
|
858 |
-
|
859 |
-
|
|
|
|
|
860 |
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
if rest_of_competitors:
|
867 |
-
new_competitor_id = rest_of_competitors.pop()
|
868 |
-
next_competitors.append(new_competitor_id)
|
869 |
-
result_url[new_competitor_id] = check_significance_send_task(new_model_file, self.submission_id_to_file[new_competitor_id])
|
870 |
-
result_inverse_url[new_competitor_id] = check_significance_send_task(self.submission_id_to_file[new_competitor_id], new_model_file)
|
871 |
-
|
872 |
-
new_tournament[new_submission_id][competitor_id] = result
|
873 |
-
new_tournament[competitor_id][new_submission_id] = result_inverse
|
874 |
-
|
875 |
-
num_of_competitors_done = num_of_competitors - len(next_competitors) - len(rest_of_competitors)
|
876 |
-
gr.Info(f"Tournament: {num_of_competitors_done}/{num_of_competitors} = {(num_of_competitors_done) * 100 // num_of_competitors}% done")
|
877 |
|
878 |
return new_tournament
|
879 |
|
|
|
811 |
|
812 |
competitor_ids_in_tournament = new_tournament[new_submission_id].keys()
|
813 |
rest_of_competitors = list(self.submission_ids - {new_submission_id} - competitor_ids_in_tournament) # without self and without the opponents with which it has already contended
|
814 |
+
|
815 |
+
for competitor_id in rest_of_competitors:
|
816 |
+
new_tournament[new_submission_id][competitor_id] = copy.deepcopy(DRAW_MATCH)
|
817 |
+
new_tournament[competitor_id][new_submission_id] = copy.deepcopy(DRAW_MATCH)
|
818 |
|
819 |
return new_tournament
|
820 |
|
|
|
842 |
competitor_ids_in_tournament = new_tournament[new_submission_id].keys()
|
843 |
rest_of_competitors = list(self.submission_ids - {new_submission_id} - competitor_ids_in_tournament) # without self and without the opponents with which it has already contended
|
844 |
num_of_competitors = len(rest_of_competitors)
|
845 |
+
|
846 |
+
result_url = {}
|
847 |
+
result_inverse_url = {}
|
848 |
+
|
849 |
+
while rest_of_competitors:
|
850 |
+
next_competitors = []
|
851 |
+
while rest_of_competitors:
|
852 |
+
if len(next_competitors) < 5: # 5*2==10 tasks
|
853 |
+
next_competitors.append(rest_of_competitors.pop())
|
854 |
+
else:
|
855 |
+
break
|
856 |
|
857 |
+
for competitor_id in next_competitors:
|
858 |
+
result_url[competitor_id] = check_significance_send_task(new_model_file, self.submission_id_to_file[competitor_id])
|
859 |
+
result_inverse_url[competitor_id] = check_significance_send_task(self.submission_id_to_file[competitor_id], new_model_file)
|
860 |
|
861 |
+
while next_competitors:
|
862 |
+
competitor_id = next_competitors.pop(0)
|
863 |
+
result = check_significance_wait_for_result(result_url.pop(competitor_id))
|
864 |
+
result_inverse = check_significance_wait_for_result(result_inverse_url.pop(competitor_id))
|
|
|
|
|
|
|
865 |
|
866 |
+
if rest_of_competitors:
|
867 |
+
new_competitor_id = rest_of_competitors.pop()
|
868 |
+
next_competitors.append(new_competitor_id)
|
869 |
+
result_url[new_competitor_id] = check_significance_send_task(new_model_file, self.submission_id_to_file[new_competitor_id])
|
870 |
+
result_inverse_url[new_competitor_id] = check_significance_send_task(self.submission_id_to_file[new_competitor_id], new_model_file)
|
871 |
|
872 |
+
new_tournament[new_submission_id][competitor_id] = result
|
873 |
+
new_tournament[competitor_id][new_submission_id] = result_inverse
|
874 |
+
|
875 |
+
num_of_competitors_done = num_of_competitors - len(next_competitors) - len(rest_of_competitors)
|
876 |
+
gr.Info(f"Tournament: {num_of_competitors_done}/{num_of_competitors} = {(num_of_competitors_done) * 100 // num_of_competitors}% done")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
877 |
|
878 |
return new_tournament
|
879 |
|