-
Notifications
You must be signed in to change notification settings - Fork 383
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
Make sure that the Number of runs is displayed correctly #4242
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.
I think silently suppressing the generic exception object is never a good idea. Maybe there are exceptions (hehe), but this just isn't it in my view.
048b22c
to
db38d84
Compare
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'd be thrilled to learn what kind of exceptions can come out of here, but also submit to the fact we can't just blindly release them first. LGTM.
@@ -3424,10 +3424,24 @@ def removeRun(self, run_id, run_filter): | |||
# cascades and such. Deleting runs in separate transactions don't | |||
# exceed a potential statement timeout threshold in a DBMS. | |||
runs = [] | |||
run_no = 0 |
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'm not sure run_no
is a clear variable name. Maybe deleted_run_cnt or something else would be better.
# counter is not affected by the exception. | ||
LOG.warning(f"Suppressed an exception while " | ||
f"deleting run {run.name}. Error: {e}") | ||
pass |
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.
Unnecessary pass
statement.
# expected to never occur, but there have been some rare | ||
# cases where it occurred due to underlying reasons. | ||
# Handling it silently ensures that the Number of runs | ||
# counter is not affected by the exception. |
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.
One reason of the exception can be an SQL statement timeout while a too large run is being deleted. We should include another TODO here which suggests the catching of SQLAlchemyError
instead of the generic Exception
when we can make this sure based on the warnings messages below, in the server logs.
In some rare cases, when an error occurs while deleting runs, the number of runs to be deleted is deducted from the "Number of runs" value displayed in the "Products" view, even though some runs do not get deleted. For this reason, the number of runs could go negative upon the next run deletion. This change is to fix this issue.
db38d84
to
3abcb42
Compare
In some rare cases, when an error occurs while deleting
runs, the number of runs to be deleted is deducted from
the "Number of runs" value displayed in the
"Products" view, even though some runs do not get
deleted. For this reason, the number of runs could go
negative upon the next run deletion.
This change is to fix this issue.