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

feat: Implement Celery SoftTimeLimit handling #13740

Merged
merged 3 commits into from
Apr 12, 2021

Conversation

lilykuang
Copy link
Member

SUMMARY

  • Implement Celery SoftTimeLimit handling

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TEST PLAN

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 22, 2021

Codecov Report

Merging #13740 (800761b) into master (667eb83) will increase coverage by 0.03%.
The diff coverage is 89.47%.

❗ Current head 800761b differs from pull request most recent head 009c43a. Consider uploading reports for the commit 009c43a to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master   #13740      +/-   ##
==========================================
+ Coverage   79.40%   79.43%   +0.03%     
==========================================
  Files         938      938              
  Lines       47541    47553      +12     
  Branches     5940     5940              
==========================================
+ Hits        37749    37774      +25     
+ Misses       9666     9653      -13     
  Partials      126      126              
Flag Coverage Δ
cypress 56.06% <ø> (+<0.01%) ⬆️
hive 80.54% <89.47%> (+0.05%) ⬆️
mysql 80.81% <89.47%> (+0.05%) ⬆️
postgres 80.84% <89.47%> (+0.05%) ⬆️
presto 80.56% <89.47%> (+0.05%) ⬆️
python 81.41% <89.47%> (+0.05%) ⬆️
sqlite 80.45% <89.47%> (+0.05%) ⬆️

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

Impacted Files Coverage Δ
superset/tasks/scheduler.py 74.54% <33.33%> (-2.38%) ⬇️
superset/reports/commands/alert.py 96.47% <100.00%> (+0.04%) ⬆️
superset/reports/commands/execute.py 92.85% <100.00%> (+0.03%) ⬆️
superset/sql_lab.py 81.56% <100.00%> (+1.38%) ⬆️
superset/tasks/async_queries.py 92.06% <100.00%> (+0.99%) ⬆️
...set-frontend/src/dashboard/util/getDropPosition.js 92.42% <0.00%> (+1.51%) ⬆️
superset/reports/commands/log_prune.py 85.71% <0.00%> (+39.28%) ⬆️

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 667eb83...009c43a. Read the comment docs.

@lilykuang lilykuang force-pushed the lily/soft-time-limit branch 4 times, most recently from 1b6ec9b to 27d98f5 Compare March 22, 2021 23:47
@willbarrett willbarrett requested a review from dpgaspar March 29, 2021 20:21
@willbarrett
Copy link
Member

@dpgaspar would you mind taking a look at this?

@@ -146,7 +146,8 @@ def _execute_query(self) -> pd.DataFrame:
rendered_sql, ALERT_SQL_LIMIT
)
return self._report_schedule.database.get_df(limited_rendered_sql)
except SoftTimeLimitExceeded:
except SoftTimeLimitExceeded as ex:
logger.error("A timeout occurred while executing the alert query: %s", 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 don't think we need to log the errors - this is somewhat expected behavior.

Copy link
Member

@dpgaspar dpgaspar left a comment

Choose a reason for hiding this comment

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

Looks good, logging has a warning is probably better, left a couple of comments also

@@ -67,6 +68,8 @@ def execute(report_schedule_id: int, scheduled_dttm: str) -> None:
AsyncExecuteReportScheduleCommand(report_schedule_id, scheduled_dttm_).run()
except ReportScheduleUnexpectedError as ex:
logger.error("An unexpected occurred while executing the report: %s", ex)
except SoftTimeLimitExceeded as ex:
Copy link
Member

Choose a reason for hiding this comment

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

nit: this is probably unnecessary because we already catch and reraise it here: https://github.com/apache/superset/blob/master/superset/reports/commands/execute.py#L183

logger.error("Query %d: Time limit exceeded", query_id)
logger.debug("Query %d: %s", query_id, ex)
raise SqlLabTimeoutException(
"SQL Lab timeout. This environment's policy is to kill queries "
Copy link
Member

Choose a reason for hiding this comment

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

If this error goes to the user we should translate it using flask babel

@lilykuang lilykuang force-pushed the lily/soft-time-limit branch 5 times, most recently from 6a7b823 to d291ec3 Compare April 1, 2021 22:14
@lilykuang lilykuang force-pushed the lily/soft-time-limit branch from d291ec3 to 009c43a Compare April 9, 2021 00:42
@pull-request-size pull-request-size bot added size/L and removed size/M labels Apr 9, 2021
@lilykuang lilykuang merged commit 7980b76 into apache:master Apr 12, 2021
@lilykuang lilykuang deleted the lily/soft-time-limit branch April 12, 2021 20:18
amitmiran137 pushed a commit that referenced this pull request Apr 13, 2021
* master:
  fix: unable to apply logging format (#14074)
  refactor: Bootstrap to AntD - Slider (#13989)
  chore(spa refactor): refactoring dashboard to use api's instead of bootstrapdata (#13306)
  fix(listview): update listview feature flag (#13906)
  Add docs for configuring Docker Compose setup (#13961)
  feat: invalid password error message (Postgres) (#14038)
  fix: flacky test in test_update_dataset_item_w_override_columns (#14082)
  feat: Implement Celery SoftTimeLimit handling (#13740)
  feat: only send alert error emails to owners of the alert (#13862)
  feat: add descriptions to report emails (#13827)
  Make chart exclude itself from cross filtering (#14046)
  fix: fix bug when remove chart not  removing it's related cross filter data (#14081)
  feat(native-filters): Add default first value to select filter (#13726)
  feat: Make async query JWT cookie domain configurable (#14007)
  fix: add exception to catch session not having JWT (#14036)

# Conflicts:
#	superset-frontend/src/dashboard/actions/hydrate.js
#	superset/views/core.py
amitmiran137 pushed a commit that referenced this pull request Apr 13, 2021
* master: (53 commits)
  test: Adds tests to the UndoRedoKeyListeners component (#13919)
  chore: Adds dataMask reducer to reducerIndex (#13951)
  test: Tests audit for the Dashboard FilterBar (#13916)
  fix: unable to apply logging format (#14074)
  refactor: Bootstrap to AntD - Slider (#13989)
  chore(spa refactor): refactoring dashboard to use api's instead of bootstrapdata (#13306)
  fix(listview): update listview feature flag (#13906)
  Add docs for configuring Docker Compose setup (#13961)
  feat: invalid password error message (Postgres) (#14038)
  fix: flacky test in test_update_dataset_item_w_override_columns (#14082)
  feat: Implement Celery SoftTimeLimit handling (#13740)
  feat: only send alert error emails to owners of the alert (#13862)
  feat: add descriptions to report emails (#13827)
  Make chart exclude itself from cross filtering (#14046)
  fix: fix bug when remove chart not  removing it's related cross filter data (#14081)
  feat(native-filters): Add default first value to select filter (#13726)
  feat: Make async query JWT cookie domain configurable (#14007)
  fix: add exception to catch session not having JWT (#14036)
  Use consistent chart value (#14031)
  fix: Use superset generic db to catch external_metadata queries (#13974)
  ...
allanco91 pushed a commit to allanco91/superset that referenced this pull request May 21, 2021
* log soft time limit error

* lint

* update test
QAlexBall pushed a commit to QAlexBall/superset that referenced this pull request Dec 29, 2021
* log soft time limit error

* lint

* update 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