Spaces:
Running
Running
Measuring how long it takes to renew tournament results
Browse files
server.py
CHANGED
@@ -14,6 +14,7 @@ print(f"{os.environ.get('REQUESTS_CA_BUNDLE') = }")
|
|
14 |
|
15 |
import hashlib
|
16 |
import time
|
|
|
17 |
import requests
|
18 |
from collections import namedtuple
|
19 |
from xml.sax.saxutils import escape as xmlEscape, quoteattr as xmlQuoteAttr
|
@@ -362,6 +363,9 @@ class LeaderboardServer:
|
|
362 |
else:
|
363 |
break
|
364 |
|
|
|
|
|
|
|
365 |
gr.Info('Running tournament...', duration=15)
|
366 |
with self.var_lock.rw:
|
367 |
self.tournament_results = {}
|
@@ -374,6 +378,10 @@ class LeaderboardServer:
|
|
374 |
with self.var_lock.rw:
|
375 |
self.tournament_results = tournament_results
|
376 |
self.submission_ids.add(submission_id)
|
|
|
|
|
|
|
|
|
377 |
|
378 |
gr.Info('Uploading tournament results...', duration=5)
|
379 |
if self.tournament_results:
|
|
|
14 |
|
15 |
import hashlib
|
16 |
import time
|
17 |
+
from datetime import datetime, timezone
|
18 |
import requests
|
19 |
from collections import namedtuple
|
20 |
from xml.sax.saxutils import escape as xmlEscape, quoteattr as xmlQuoteAttr
|
|
|
363 |
else:
|
364 |
break
|
365 |
|
366 |
+
renew_tournament_began_datetime = datetime.now(timezone.utc)
|
367 |
+
datetime2str = lambda d: d.strftime("%Y-%m-%dT%H:%M:%S %Z")
|
368 |
+
print(f"Renew tournament began at {datetime2str(renew_tournament_began_datetime)}")
|
369 |
gr.Info('Running tournament...', duration=15)
|
370 |
with self.var_lock.rw:
|
371 |
self.tournament_results = {}
|
|
|
378 |
with self.var_lock.rw:
|
379 |
self.tournament_results = tournament_results
|
380 |
self.submission_ids.add(submission_id)
|
381 |
+
renew_tournament_ended_datetime = datetime.now(timezone.utc)
|
382 |
+
print(f"Renew tournament ended at {datetime2str(renew_tournament_ended_datetime)}")
|
383 |
+
renew_tournament_ended_time_elapsed = renew_tournament_ended_datetime - renew_tournament_began_datetime
|
384 |
+
print(f"Time elapsed: {renew_tournament_ended_time_elapsed}")
|
385 |
|
386 |
gr.Info('Uploading tournament results...', duration=5)
|
387 |
if self.tournament_results:
|