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(cli): fail CLI script on failed import/export #16976

Merged
merged 2 commits into from
Oct 29, 2021

Conversation

EBoisseauSierra
Copy link
Contributor

@EBoisseauSierra EBoisseauSierra commented Oct 5, 2021

SUMMARY

During a CLI import or export of dashboards, if the process fails, the
exception it caught and a simple message is sent to the logger.
This makes that from a shell point of view, the script was successfull —
cf. #16956.

To prevent this, we re-raise the exception once it has been logged on
the logger.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

n/a

TESTING INSTRUCTIONS

New unit tests added to tests/integration_tests/cli_tests.py.

ADDITIONAL INFORMATION

  • Has associated issue: I want superset {im, ex}port to *fail* if unsuccessful #16956
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@EBoisseauSierra
Copy link
Contributor Author

@dpgaspar here we go!

It's a very naive approach, though. Plus we might need testing — but I can't make it work locally. So I'm very much looking forward to some guidance — happy to continue on Slack.

@dpgaspar dpgaspar self-requested a review October 12, 2021 13:05
For each CLI entry-point we will modify, we make sure that:

- a failing process exits with a non-0 exit code,
- an error is logged.

Signed-off-by: Étienne Boisseau-Sierra <etienne.boisseau-sierra@unipart.io>
@EBoisseauSierra EBoisseauSierra changed the title fix(cli): fail CLI script on failed import/export [WIP] fix(cli): fail CLI script on failed import/export Oct 19, 2021
@EBoisseauSierra EBoisseauSierra marked this pull request as ready for review October 19, 2021 09:39
@codecov
Copy link

codecov bot commented Oct 19, 2021

Codecov Report

Merging #16976 (8965943) into master (d38e686) will decrease coverage by 0.11%.
The diff coverage is 66.66%.

❗ Current head 8965943 differs from pull request most recent head 3fde6ca. Consider uploading reports for the commit 3fde6ca to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master   #16976      +/-   ##
==========================================
- Coverage   76.91%   76.79%   -0.12%     
==========================================
  Files        1038     1038              
  Lines       55557    55563       +6     
  Branches     7567     7567              
==========================================
- Hits        42729    42671      -58     
- Misses      12578    12642      +64     
  Partials      250      250              
Flag Coverage Δ
hive ?
mysql 81.93% <66.66%> (+0.02%) ⬆️
postgres 81.94% <66.66%> (+0.02%) ⬆️
presto 81.80% <66.66%> (+0.02%) ⬆️
python 82.19% <66.66%> (-0.22%) ⬇️
sqlite 81.61% <66.66%> (+0.02%) ⬆️

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

Impacted Files Coverage Δ
superset/cli.py 54.92% <66.66%> (+2.07%) ⬆️
superset/db_engines/hive.py 0.00% <0.00%> (-85.19%) ⬇️
superset/db_engine_specs/hive.py 69.76% <0.00%> (-17.06%) ⬇️
superset/connectors/sqla/models.py 87.08% <0.00%> (-0.24%) ⬇️
superset/utils/core.py 89.97% <0.00%> (-0.12%) ⬇️

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 d38e686...3fde6ca. Read the comment docs.

Bubble exception up when failing import or export

During a CLI import or export of dashboards, if the process fails, the
exception it caught and a simple message is sent to the logger.
This makes that from a shell point of view, the script was successfull —
cf. apache#16956.

To prevent this, we want to ensure that the process exits with an error
(i.e., a non-0 exit-code) should the export or import fail mid-flight.

Signed-off-by: Étienne Boisseau-Sierra <etienne.boisseau-sierra@unipart.io>
@EBoisseauSierra
Copy link
Contributor Author

@dpgaspar shall we try merging it on time for 1.4?!

@dpgaspar dpgaspar merged commit f0c0ef7 into apache:master Oct 29, 2021
@eschutho eschutho added the v1.4 label Nov 11, 2021
eschutho pushed a commit that referenced this pull request Nov 17, 2021
* Test that failing export or import is done properly

For each CLI entry-point we will modify, we make sure that:

- a failing process exits with a non-0 exit code,
- an error is logged.

Signed-off-by: Étienne Boisseau-Sierra <etienne.boisseau-sierra@unipart.io>

* Exit process with error if export/import failed

Bubble exception up when failing import or export

During a CLI import or export of dashboards, if the process fails, the
exception it caught and a simple message is sent to the logger.
This makes that from a shell point of view, the script was successfull —
cf. #16956.

To prevent this, we want to ensure that the process exits with an error
(i.e., a non-0 exit-code) should the export or import fail mid-flight.

Signed-off-by: Étienne Boisseau-Sierra <etienne.boisseau-sierra@unipart.io>
(cherry picked from commit f0c0ef7)
AAfghahi pushed a commit that referenced this pull request Jan 10, 2022
* Test that failing export or import is done properly

For each CLI entry-point we will modify, we make sure that:

- a failing process exits with a non-0 exit code,
- an error is logged.

Signed-off-by: Étienne Boisseau-Sierra <etienne.boisseau-sierra@unipart.io>

* Exit process with error if export/import failed

Bubble exception up when failing import or export

During a CLI import or export of dashboards, if the process fails, the
exception it caught and a simple message is sent to the logger.
This makes that from a shell point of view, the script was successfull —
cf. #16956.

To prevent this, we want to ensure that the process exits with an error
(i.e., a non-0 exit-code) should the export or import fail mid-flight.

Signed-off-by: Étienne Boisseau-Sierra <etienne.boisseau-sierra@unipart.io>
@EBoisseauSierra EBoisseauSierra deleted the fail-on-failed-import branch May 9, 2023 08:36
@mistercrunch mistercrunch added 🍒 1.4.0 🍒 1.4.1 🍒 1.4.2 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.5.0 labels Mar 13, 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 size/L v1.4 🍒 1.4.0 🍒 1.4.1 🍒 1.4.2 🚢 1.5.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants