-
Notifications
You must be signed in to change notification settings - Fork 63
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
Fix for enhancement#1003: Google Code-in Task to add a command for di… #256
base: master
Are you sure you want to change the base?
Changes from 1 commit
6cc751d
4e0ca29
d61f216
8297d3f
ce52984
1b3966c
7aabe6e
82ed9b2
4536430
d491836
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import os | ||
|
||
import base64 | ||
import boto3 | ||
import click | ||
import docker | ||
import json | ||
import requests | ||
import shutil | ||
import sys | ||
import tempfile | ||
import urllib.parse as urlparse | ||
import uuid | ||
|
||
from click import echo, style | ||
|
||
from evalai.utils.common import notify_user | ||
from evalai.utils.requests import make_request | ||
from evalai.utils.submissions import ( | ||
display_submission_stderr, | ||
convert_bytes_to, | ||
) | ||
from evalai.utils.urls import URLS | ||
from evalai.utils.config import EVALAI_HOST_URLS, HOST_URL_FILE_PATH | ||
|
||
|
||
class Submission(object): | ||
|
||
def __init__(self, submission_id): | ||
self.submission_id = submission_id | ||
|
||
|
||
@click.group(invoke_without_command=True) | ||
@click.argument("SUBMISSION_ID", type=int) | ||
@click.pass_context | ||
def submission_error(ctx, submission_id): | ||
""" | ||
Display submission Error using submission id. | ||
""" | ||
""" | ||
Invoked by `evalai submission_error SUBMISSION_ID`. | ||
""" | ||
ctx.obj = Submission(submission_id=submission_id) | ||
if ctx.invoked_subcommand is None: | ||
display_submission_stderr(submission_id) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -280,6 +280,28 @@ def display_submission_result(submission_id): | |
) | ||
) | ||
|
||
def display_submission_stderr(submission_id): | ||
""" | ||
Function to display stderr file of a particular submission in Terminal output | ||
""" | ||
try: | ||
response = submission_details_request(submission_id).json() | ||
file_url = requests.get(response['stderr_file']).text | ||
with open(file_url, "r") as fr: | ||
try: | ||
file_contents = fr.read() | ||
print (file_contents) | ||
fr.close() | ||
except (OSError, IOError) as e: | ||
echo(e) | ||
except requests.exceptions.MissingSchema: | ||
echo( | ||
style( | ||
"\nThe Submission is yet to be evaluated.\n", | ||
bold=True, | ||
fg="yellow", | ||
) | ||
) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you explain why have you used There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @vkartik97, I used this exception because as per your earlier note on my previous task “display stdout message in terminal” the stdout file is generated after the submission evaluation is completed. So if the submission id is not available means that it is supposed to be "yet to be evaluated". So I thought that would be right exception error. I just followed the same def function “display_submission_result” code from submissions.py for this one as well. Let me know if you don’t want this exception to be shown, then what exception you are suggesting. Thank you There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can use other exception or use |
||
|
||
def convert_bytes_to(byte, to, bsize=1024): | ||
""" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about you nest this under
submission command
:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As suggested I updated the changes. please review and let me know in google codein task page.
to test use:
evalai submission 48728 stderr