diff --git a/evalai/submissions.py b/evalai/submissions.py index ac8bccf62..bd0e75997 100644 --- a/evalai/submissions.py +++ b/evalai/submissions.py @@ -18,7 +18,7 @@ from evalai.utils.requests import make_request from evalai.utils.submissions import ( display_submission_details, - display_submission_result, + display_submission_file_data, convert_bytes_to, ) from evalai.utils.urls import URLS @@ -60,7 +60,8 @@ def result(ctx): """ Invoked by `evalai submission SUBMISSION_ID result`. """ - display_submission_result(ctx.submission_id) + error_message = "\nThe Submission is yet to be evaluated.\n" + display_submission_file_data(ctx.submission_id, "submission_result_file", error_message) @click.command() diff --git a/evalai/utils/submissions.py b/evalai/utils/submissions.py index 19d9fc3e4..9bf70d914 100644 --- a/evalai/utils/submissions.py +++ b/evalai/utils/submissions.py @@ -264,17 +264,17 @@ def display_submission_details(submission_id): pretty_print_submission_details(response) -def display_submission_result(submission_id): +def display_submission_file_data(submission_id, file_name, error_message): """ - Function to display result of a particular submission + Function to display information of a particular submission """ try: response = submission_details_request(submission_id).json() - echo(requests.get(response['submission_result_file']).text) + echo(requests.get(response[file_name]).text) except requests.exceptions.MissingSchema: echo( style( - "\nThe Submission is yet to be evaluated.\n", + error_message, bold=True, fg="red", )