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

added show stdout cmd #240

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
31 changes: 31 additions & 0 deletions evalai/show_stdout.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env python3

import click
import os


from click import echo, style
from evalai.utils.config import AUTH_TOKEN_DIR


@click.group(invoke_without_command=True)
def show_stdout():
"""
Shows output data from stdout.txt file.
"""
file_path = os.path.join(AUTH_TOKEN_DIR, "stdout.txt")
if not os.path.exists(file_path):
echo(
style(
"The stdout.txt file does not exist.",
bold=True,
fg="red",
)
)
else:
with open(file_path, "r") as fr:
try:
stdout = fr.read()
echo(stdout)
except (OSError, IOError) as e:
echo(str(e))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also exit with non-zero integer.