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

fix(alerts&reports): add celery soft timeout support #13436

Conversation

dpgaspar
Copy link
Member

@dpgaspar dpgaspar commented Mar 3, 2021

SUMMARY

Handles specifically celery's SoftTimeoutExceeded exception on alerts and reports.

On alerts:

  • Adds a specific message for this event on alerts, this was handled, but caught on a DBAPI broad exception catch.

On reports:

  • screenshots swallow all webdriver exceptions and return None, added an extra broad exception that can handle SoftTimeoutExceeded, other exceptions can occur and these were not handled.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Changes UI
  • Requires DB Migration.
  • Confirm DB Migration upgrade and downgrade tested.
  • Introduces new feature or API
  • Removes existing feature or API

@codecov
Copy link

codecov bot commented Mar 3, 2021

Codecov Report

Merging #13436 (7c8e079) into master (b04aebf) will decrease coverage by 5.81%.
The diff coverage is 48.86%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #13436      +/-   ##
==========================================
- Coverage   77.23%   71.42%   -5.82%     
==========================================
  Files         900      807      -93     
  Lines       45601    40905    -4696     
  Branches     5415     4210    -1205     
==========================================
- Hits        35221    29216    -6005     
- Misses      10253    11689    +1436     
+ Partials      127        0     -127     
Flag Coverage Δ
cypress 57.50% <36.58%> (-0.44%) ⬇️
hive ?
javascript ?
mysql 80.41% <89.59%> (+0.10%) ⬆️
postgres 80.45% <89.59%> (+0.10%) ⬆️
presto 80.12% <89.59%> (+0.10%) ⬆️
python 80.68% <89.59%> (-0.17%) ⬇️
sqlite 80.07% <89.59%> (+0.10%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...erset-frontend/src/SqlLab/components/SouthPane.jsx 64.10% <ø> (-17.95%) ⬇️
...et-frontend/src/SqlLab/reducers/getInitialState.js 50.00% <ø> (ø)
superset-frontend/src/SqlLab/reducers/sqlLab.js 17.47% <0.00%> (-23.10%) ⬇️
...src/SqlLab/utils/reduxStateToLocalStorageHelper.js 61.53% <ø> (-38.47%) ⬇️
superset-frontend/src/chart/ChartContainer.jsx 100.00% <ø> (ø)
...ontend/src/common/components/InfoTooltip/index.tsx 33.33% <ø> (ø)
...erset-frontend/src/components/AnchorLink/index.jsx 66.66% <ø> (ø)
...nd/src/components/BootstrapSliderWrapper/index.jsx 0.00% <ø> (ø)
...perset-frontend/src/components/ChartIcon/index.tsx 50.00% <ø> (ø)
...-frontend/src/components/CopyToClipboard/index.jsx 57.14% <ø> (ø)
... and 574 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b04aebf...8ce275d. Read the comment docs.

@@ -155,6 +155,10 @@ class AlertQueryError(CommandException):
message = _("Alert found an error while executing a query.")


class AlertQueryTimeout(CommandException):
message = _("A timeout occurred while executing the query.")
Copy link
Member

Choose a reason for hiding this comment

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

As this can happen during either the query or the thumbnail computation, perhaps we should reword this as "A timeout occurred while executing the background job." - is this the same message that would trigger when a Report times out?

Copy link
Member Author

Choose a reason for hiding this comment

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

not the same message, this is really specific for queries

Copy link
Member Author

Choose a reason for hiding this comment

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

created a specific exception for screenshots timeout also

@pull-request-size pull-request-size bot added size/L and removed size/M labels Mar 4, 2021
@dpgaspar dpgaspar requested review from willbarrett and villebro March 5, 2021 08:22
Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

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

LGTM - one minor docstring nit + would be nice to reach full coverage on the exception tests.

Comment on lines 60 to 65
:raises: AlertQueryError,
AlertQueryInvalidTypeError,
AlertQueryMultipleColumnsError,
AlertQueryMultipleRowsError,
AlertQueryTimeout,
AlertValidatorConfigError
Copy link
Member

Choose a reason for hiding this comment

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

nit: while there are many conventions out there, I believe this is the one we mostly use in Superset:

:raises Exception1: reason1
:raises Exception2: reason2

Executes the actual alert SQL query template

:return: A pandas dataframe
:raises: AlertQueryTimeout, AlertQueryError
Copy link
Member

Choose a reason for hiding this comment

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

same here

Comment on lines +181 to +184
except Exception as ex:
raise ReportScheduleScreenshotFailedError(
f"Failed taking a screenshot {str(ex)}"
)
Copy link
Member

Choose a reason for hiding this comment

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

I'm stealing codecov's comment here, but could we add a test for this broad exception case, too?

@dpgaspar dpgaspar merged commit 139c787 into apache:master Mar 8, 2021
@dpgaspar dpgaspar deleted the danielgaspar/ch5697/implement-handling-of-softtimelimit-exception branch March 8, 2021 14:21
allanco91 pushed a commit to allanco91/superset that referenced this pull request May 21, 2021
* fix(alerts&reports): add celery soft timeout support

* make a specific exception for screenshots timeout

* fix docs, add new test
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.2.0 labels Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels preset-io size/L 🚢 1.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants