From 1f8e16a5d8c7839f8cdce746400d289518a42661 Mon Sep 17 00:00:00 2001 From: Danyaal Masood Date: Wed, 22 Feb 2023 09:26:49 +0000 Subject: [PATCH] Ensure hide_code option is persisted and used in reruns --- notebooker/execute_notebook.py | 2 ++ notebooker/web/routes/report_execution.py | 2 ++ tests/integration/test_e2e.py | 6 ++++++ 3 files changed, 10 insertions(+) diff --git a/notebooker/execute_notebook.py b/notebooker/execute_notebook.py index 33b7cce..f02ff0d 100644 --- a/notebooker/execute_notebook.py +++ b/notebooker/execute_notebook.py @@ -136,6 +136,7 @@ def _run_checks( overrides=overrides, scheduler_job_id=scheduler_job_id, mailfrom=mailfrom, + hide_code=hide_code, is_slideshow=is_slideshow, ) return notebook_result @@ -218,6 +219,7 @@ def run_report( generate_pdf_output=generate_pdf_output, scheduler_job_id=scheduler_job_id, mailfrom=mailfrom, + hide_code=hide_code, is_slideshow=is_slideshow, ) logger.error( diff --git a/notebooker/web/routes/report_execution.py b/notebooker/web/routes/report_execution.py index cd05083..203d82b 100644 --- a/notebooker/web/routes/report_execution.py +++ b/notebooker/web/routes/report_execution.py @@ -234,6 +234,7 @@ def _rerun_report(job_id, prepare_only=False, run_synchronously=False): abort(404) prefix = "Rerun of " title = result.report_title if result.report_title.startswith(prefix) else (prefix + result.report_title) + with current_app.app_context(): app_config = WebappConfig.from_superset_kwargs(current_app.config) new_job_id = run_report_in_subprocess( @@ -242,6 +243,7 @@ def _rerun_report(job_id, prepare_only=False, run_synchronously=False): title, result.mailto, result.overrides, + hide_code=result.hide_code, generate_pdf_output=result.generate_pdf_output, prepare_only=prepare_only, scheduler_job_id=None, # the scheduler will never call rerun diff --git a/tests/integration/test_e2e.py b/tests/integration/test_e2e.py index 024a81a..f4dc331 100644 --- a/tests/integration/test_e2e.py +++ b/tests/integration/test_e2e.py @@ -113,6 +113,8 @@ def test_run_report_and_rerun( generate_pdf_output=False, prepare_only=True, run_synchronously=True, + hide_code=True, + is_slideshow=True, ) _check_report_output( job_id, @@ -122,6 +124,8 @@ def test_run_report_and_rerun( report_title=report_title, mailto=mailto, generate_pdf_output=False, + hide_code=True, + is_slideshow=True, ) new_job_id = _rerun_report(job_id, prepare_only=True, run_synchronously=True) @@ -133,6 +137,8 @@ def test_run_report_and_rerun( report_title="Rerun of " + report_title, mailto=mailto, generate_pdf_output=False, + hide_code=True, + is_slideshow=True, ) assert new_job_id == serialiser.get_latest_job_id_for_name_and_params(report_name, overrides) assert not {job_id, new_job_id} - set(serialiser.get_all_job_ids_for_name_and_params(report_name, overrides))