Skip to content

Commit

Permalink
Add upload time to problem import.
Browse files Browse the repository at this point in the history
Might help debugging #2019
but is also useful in general.
  • Loading branch information
meisterT committed Nov 16, 2024
1 parent 0b1885b commit 0685296
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion misc-tools/import-contest.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import os.path
import re
import subprocess
import sys
import time
import yaml

sys.path.append('@domserver_libdir@')
Expand Down Expand Up @@ -240,10 +241,13 @@ if os.path.exists('problems.yaml') or os.path.exists('problems.json') or os.path

if ((not confirmIndividually) or dj_utils.confirm(f'Ready to import problem \'{problem}\' to problem={problem}. Continue?', True)):
print(f'Uploading problem \'{problem}\', please be patient, this may take a while.')
before = time.time()
response = dj_utils.upload_file(
f'contests/{cid}/problems', 'zip', f'{problem}.zip', {'problem': problem})
after = time.time()
if response and 'problem_id' in response:
print(f'Problem imported with ID {response["problem_id"]}:')
upload_time = after - before
print(f'Problem imported with ID {response["problem_id"]} (took {upload_time:.2f}s):')
if 'messages' in response:
messages = response['messages']
types = {'info': '🛈 ', 'warning': '⚠️ ', 'danger': '🚨'}
Expand Down

0 comments on commit 0685296

Please sign in to comment.