-
Notifications
You must be signed in to change notification settings - Fork 178
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
feat(abt): speed up analyses battery with async analysis #16431
Conversation
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.
TY! Here's a Python coding practices suggestion, but it doesn't block merging.
except Exception as e: | ||
console.print(f"An error occurred during analysis: {e}") |
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.
For future reference, as a general practice, I think we should avoid stringifying exceptions like {e}
or str(e)
. It can be okay for certain exception types, but in the general except Exception
case, like here, it can give you confusing and incomplete information. For example, if a KeyError
came from some_dict["foo"]
, this would only print:
An error occurred during analysis: foo
If you're using logging
, you can do exc_info=True
to automatically include full exception information, like:
except Exception:
log.warn("An error occurred during analysis.", exc_info=True)
If you're not using logging
, like in this case, you can use something like traceback.print_exception()
(output to a file) or traceback.format_exception()
(output to a string).
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.
Thank you for the suggestion. Helped me in another spot today 😊
I will merge this but will fix this to use Rich console exception printing in another PR. It is totally wrong.
Overview
Remove cruft from
generate_analyses.py
and analyze againstn
containers in a ThreadPoolExecutor.