-
Notifications
You must be signed in to change notification settings - Fork 191
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
Improve error log to json in run_sorter #3057
Improve error log to json in run_sorter #3057
Conversation
error_log_to_display = traceback.format_exc() | ||
trace_lines = error_log_to_display.strip().split("\n") | ||
error_to_json = ["Traceback (most recent call last):"] + [ | ||
f" {line}" if not line.startswith(" ") else line for line in trace_lines[1:] |
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.
Is the space before {line}
needed?
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.
I don't think so. Removing it.
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.
Oh no sorry I understand maybe it was to keep the left-alignment the same for lines that already start with a space vs. dont? In that case can leave, or maybe just .strip()
all lines?
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.
I feel it does not matter that much? The big gain is dividing the error trace in lines so it does not appear like a super-long-line in json I feel.
Nice! This looks good to me and I appreciate it after doing lots of scrolling to read those error messages. My only thoughts are (I know nothing about how these stacktraces are generated) to be sure that the line |
This is the python trace that we get from the module: https://docs.python.org/3/library/traceback.html They are meant to be displayed in a terminal so they will be divided by lines. My confidence is that it will generalize but of course can't know, we will have to wait and see. |
I see it is just a generic traceback that makes sense, thanks LGTM! |
error_log_to_display = traceback.format_exc() | ||
trace_lines = error_log_to_display.strip().split("\n") | ||
error_to_json = ["Traceback (most recent call last):"] + [ | ||
f" {line}" if not line.startswith(" ") else line for line in trace_lines[1:] |
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.
Oh no sorry I understand maybe it was to keep the left-alignment the same for lines that already start with a space vs. dont? In that case can leave, or maybe just .strip()
all lines?
merci. |
As in the title.
In the current PR:
Vs what is on main: