Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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.