def generate_notebook(self, result, context):
        with open(self.notebook_template_file) as fin:
            template = jinja2.Template(fin.read())

        notebook_in = template.render(result=result, context=context)
        notebook = ipython.read_notebook(notebook_in)

        ipython.run_notebook(notebook)

        self.notebook_file = os.path.join(context.run_output_directory,
                                          self.nbbasename)
        with open(self.notebook_file, 'w') as wfh:
            ipython.write_notebook(notebook, wfh)

        if self.notebook_directory:
            shutil.copy(self.notebook_file,
                        os.path.join(self.notebook_directory))
Generate a notebook from the template and run it
dataset/ETHPy150Open ARM-software/workload-automation/wlauto/result_processors/ipynb_exporter/__init__.py/IPythonNotebookExporter.generate_notebook