Skip to content

Commit

Permalink
Ensure hide_code option is persisted and used in reruns
Browse files Browse the repository at this point in the history
  • Loading branch information
Danyaal Masood authored and Danyaal Masood committed Feb 22, 2023
1 parent 40fbb97 commit 1f8e16a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions notebooker/execute_notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 2 additions & 0 deletions notebooker/web/routes/report_execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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
Expand Down
6 changes: 6 additions & 0 deletions tests/integration/test_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
Expand All @@ -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))
Expand Down

0 comments on commit 1f8e16a

Please sign in to comment.