Maharshi Gor
commited on
Commit
·
cbf7344
1
Parent(s):
1758388
Added validation check for existing submission.
Browse files- src/submission/submit.py +7 -1
src/submission/submit.py
CHANGED
@@ -147,6 +147,12 @@ def submit_model(
|
|
147 |
return styled_error(
|
148 |
f"Daily submission limit of {DAILY_SUBMISSION_LIMIT_PER_USER} reached. Please try again in \n {time_str}."
|
149 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
try:
|
151 |
submission = create_submission(
|
152 |
username=username,
|
@@ -183,7 +189,7 @@ def submit_model(
|
|
183 |
return styled_error(f"Error submitting model: {str(e)}")
|
184 |
|
185 |
|
186 |
-
def load_demo_example(model_name: str, competition_type: CompetitionType) -> Workflow:
|
187 |
"""Load a demo example submission."""
|
188 |
examples_dir = f"{EXAMPLES_PATH}/{competition_type}"
|
189 |
filepath = f"{examples_dir}/{model_name}.yaml"
|
|
|
147 |
return styled_error(
|
148 |
f"Daily submission limit of {DAILY_SUBMISSION_LIMIT_PER_USER} reached. Please try again in \n {time_str}."
|
149 |
)
|
150 |
+
|
151 |
+
if f"{username}/{model_name}" in get_user_submission_names(competition_type, profile):
|
152 |
+
return styled_error(
|
153 |
+
f"Submission {model_name} already exists. Please use a different name for your submission."
|
154 |
+
)
|
155 |
+
|
156 |
try:
|
157 |
submission = create_submission(
|
158 |
username=username,
|
|
|
189 |
return styled_error(f"Error submitting model: {str(e)}")
|
190 |
|
191 |
|
192 |
+
def load_demo_example(model_name: str, competition_type: CompetitionType) -> Workflow | TossupWorkflow:
|
193 |
"""Load a demo example submission."""
|
194 |
examples_dir = f"{EXAMPLES_PATH}/{competition_type}"
|
195 |
filepath = f"{examples_dir}/{model_name}.yaml"
|