@@ -46,6 +46,7 @@ def _run_checks(
4646 py_template_subdir : str = "" ,
4747 scheduler_job_id : Optional [str ] = None ,
4848 mailfrom : Optional [str ] = None ,
49+ is_slideshow : bool = False ,
4950) -> NotebookResultComplete :
5051 """
5152 This is the actual method which executes a notebook, whether running in the webapp or via the entrypoint.
@@ -77,7 +78,8 @@ def _run_checks(
7778 If available, it will be part of the Error or Completed run report.
7879 mailfrom : `Optional[str]`
7980 If available, this will be the email used in the From header.
80-
81+ is_slideshow: bool
82+ Whether or not the output of this should use the equivalent of nbconvert --to slides
8183
8284 Returns
8385 -------
@@ -102,14 +104,18 @@ def _run_checks(
102104
103105 logger .info ("Executing notebook at {} using parameters {} --> {}" .format (ipynb_raw_path , overrides , output_ipynb ))
104106 pm .execute_notebook (
105- ipynb_raw_path , ipynb_executed_path , parameters = overrides , log_output = True , prepare_only = prepare_only
107+ ipynb_raw_path ,
108+ ipynb_executed_path ,
109+ parameters = overrides ,
110+ log_output = True ,
111+ prepare_only = prepare_only ,
106112 )
107113 with open (ipynb_executed_path , "r" ) as f :
108114 raw_executed_ipynb = f .read ()
109115
110116 logger .info ("Saving output notebook as HTML from {}" .format (ipynb_executed_path ))
111- html , resources = ipython_to_html (ipynb_executed_path , job_id )
112- email_html , _ = ipython_to_html (ipynb_executed_path , job_id , hide_code = hide_code )
117+ html , resources = ipython_to_html (ipynb_executed_path , job_id , is_slideshow = is_slideshow )
118+ email_html , _ = ipython_to_html (ipynb_executed_path , job_id , hide_code = hide_code , is_slideshow = is_slideshow )
113119 pdf = ipython_to_pdf (raw_executed_ipynb , report_title , hide_code = hide_code ) if generate_pdf_output else ""
114120
115121 notebook_result = NotebookResultComplete (
@@ -129,6 +135,7 @@ def _run_checks(
129135 overrides = overrides ,
130136 scheduler_job_id = scheduler_job_id ,
131137 mailfrom = mailfrom ,
138+ is_slideshow = is_slideshow ,
132139 )
133140 return notebook_result
134141
@@ -154,12 +161,17 @@ def run_report(
154161 py_template_subdir = "" ,
155162 scheduler_job_id = None ,
156163 mailfrom = None ,
164+ is_slideshow = False ,
157165):
158166
159167 job_id = job_id or str (uuid .uuid4 ())
160168 stop_execution = os .getenv ("NOTEBOOKER_APP_STOPPING" )
161169 if stop_execution :
162- logger .info ("Aborting attempt to run %s, jobid=%s as app is shutting down." , report_name , job_id )
170+ logger .info (
171+ "Aborting attempt to run %s, jobid=%s as app is shutting down." ,
172+ report_name ,
173+ job_id ,
174+ )
163175 result_serializer .update_check_status (job_id , JobStatus .CANCELLED , error_info = CANCEL_MESSAGE )
164176 return
165177 try :
@@ -170,7 +182,10 @@ def run_report(
170182 attempts_remaining ,
171183 )
172184 result_serializer .update_check_status (
173- job_id , report_name = report_name , job_start_time = job_submit_time , status = JobStatus .PENDING
185+ job_id ,
186+ report_name = report_name ,
187+ job_start_time = job_submit_time ,
188+ status = JobStatus .PENDING ,
174189 )
175190 result = _run_checks (
176191 job_id ,
@@ -190,6 +205,7 @@ def run_report(
190205 py_template_subdir = py_template_subdir ,
191206 scheduler_job_id = scheduler_job_id ,
192207 mailfrom = mailfrom ,
208+ is_slideshow = is_slideshow ,
193209 )
194210 logger .info ("Successfully got result." )
195211 result_serializer .save_check_result (result )
@@ -208,6 +224,7 @@ def run_report(
208224 generate_pdf_output = generate_pdf_output ,
209225 scheduler_job_id = scheduler_job_id ,
210226 mailfrom = mailfrom ,
227+ is_slideshow = is_slideshow ,
211228 )
212229 logger .error (
213230 "Report run failed. Saving error result to mongo library %s@%s..." ,
@@ -239,6 +256,7 @@ def run_report(
239256 py_template_subdir = py_template_subdir ,
240257 scheduler_job_id = scheduler_job_id ,
241258 mailfrom = mailfrom ,
259+ is_slideshow = is_slideshow ,
242260 )
243261 else :
244262 logger .info ("Abandoning attempt to run report. It failed too many times." )
@@ -327,6 +345,7 @@ def execute_notebook_entrypoint(
327345 prepare_notebook_only : bool ,
328346 scheduler_job_id : Optional [str ],
329347 mailfrom : Optional [str ],
348+ is_slideshow : bool ,
330349):
331350 report_title = report_title or report_name
332351 output_dir , template_dir , _ = initialise_base_dirs (output_dir = config .OUTPUT_DIR , template_dir = config .TEMPLATE_DIR )
@@ -351,6 +370,7 @@ def execute_notebook_entrypoint(
351370 logger .info ("mailfrom = %s" % mailfrom )
352371 logger .info ("pdf_output = %s" , pdf_output )
353372 logger .info ("hide_code = %s" , hide_code )
373+ logger .info ("is_slideshow = %s" , is_slideshow )
354374 logger .info ("prepare_notebook_only = %s" , prepare_notebook_only )
355375 logger .info ("scheduler job id = %s" , scheduler_job_id )
356376 logger .info ("notebooker_disable_git = %s" , notebooker_disable_git )
@@ -384,6 +404,7 @@ def execute_notebook_entrypoint(
384404 py_template_subdir = py_template_subdir ,
385405 scheduler_job_id = scheduler_job_id ,
386406 mailfrom = mailfrom ,
407+ is_slideshow = is_slideshow ,
387408 )
388409 if result .mailto :
389410 send_result_email (result , config .DEFAULT_MAILFROM )
0 commit comments