From 068529671641095822250687c47d8c1e9bd65eca Mon Sep 17 00:00:00 2001 From: Tobias Werth Date: Sat, 16 Nov 2024 11:40:37 +0100 Subject: [PATCH] Add upload time to problem import. Might help debugging https://github.com/DOMjudge/domjudge/issues/2019 but is also useful in general. --- misc-tools/import-contest.in | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/misc-tools/import-contest.in b/misc-tools/import-contest.in index 386029db41..a38f450fa5 100755 --- a/misc-tools/import-contest.in +++ b/misc-tools/import-contest.in @@ -22,6 +22,7 @@ import os.path import re import subprocess import sys +import time import yaml sys.path.append('@domserver_libdir@') @@ -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': '🚨'}