Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Submission error handling in EvalAI-CLI #236

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
19 changes: 10 additions & 9 deletions evalai/utils/submissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,17 @@ def make_submission(challenge_id, phase_id, file, submission_metadata={}):
except requests.exceptions.HTTPError as err:
if response.status_code in EVALAI_ERROR_CODES:
validate_token(response.json())
echo(
style(
"\nError: {}\n"
"\nUse `evalai challenges` to fetch the active challenges.\n"
"\nUse `evalai challenge CHALLENGE phases` to fetch the "
"active phases.\n".format(response.json()["error"]),
fg="red",
bold=True,
if "error" in response.json():
echo(
style(
"\nFailed to make submission with error: {}\n"
"\nUse `evalai challenges` to fetch the active challenges.\n"
"\nUse `evalai challenge CHALLENGE phases` to fetch the "
"active phases.\n".format(response.json().get("error")),
fg="red",
bold=True,
)
)
)
else:
echo(err)
if "input_file" in response.json():
Expand Down
2 changes: 1 addition & 1 deletion tests/test_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ def test_make_submission_for_object_does_not_exist(self):
response = result.output.strip()

expected = "Do you want to include the Submission Details? [y/N]: N\n\n{}".format(
self.expected
"Failed to make submission with error: Sorry, the object does not exist."
)
expected = "{}\n\n{}".format(
expected,
Expand Down