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

Add Internal Server Error log output #243

Closed
wants to merge 9 commits into from
Closed
Changes from 1 commit
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
29 changes: 28 additions & 1 deletion examples/inference/api_server_simple/query_single.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,35 @@
json=sample_input,
stream=args.streaming_response,
)
try:
Copy link
Contributor

@xwu99 xwu99 Jun 7, 2024

Choose a reason for hiding this comment

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

I don't' think we can add the debug info in the examples code since they are for users.
Could you add the check from CI script? or figure out a way to print this from the serve side.

outputs.raise_for_status()
except requests.exceptions.HTTPError as err:
if "Internal Server Error" in str(err):
import os

folder_path = "/tmp/ray/session_latest/logs/serve"
latest_file = None
latest_time = 0.0

for file_name in os.listdir(folder_path):
if file_name.startswith("replica") and file_name.endswith(".log"):
file_path = os.path.join(folder_path, file_name)
file_time = os.path.getmtime(file_path)
if file_time > latest_time:
latest_time = file_time
latest_file = file_path
if latest_file:
print("latest file:", latest_file)
with open(latest_file, "r") as file:
lines = file.readlines()
if lines:
print("Latest Internal Server Error logs:", lines)
else:
print("Internal Server Error logs: Empty")
else:
raise err


outputs.raise_for_status()
if args.streaming_response:
for output in outputs.iter_content(chunk_size=None, decode_unicode=True):
print(output, end="", flush=True)
Expand Down
Loading