Skip to content

Commit 85257a7

Browse files
committed
Add upload time to problem import.
Might help debugging #2019 but is also useful in general.
1 parent 0b1885b commit 85257a7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

misc-tools/import-contest.in

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import os.path
2222
import re
2323
import subprocess
2424
import sys
25+
import time
2526
import yaml
2627

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

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

0 commit comments

Comments
 (0)