def update_notebook_by_run(path): rundb.reset_run(path) logging.debug(u'update_notebook_by_run {}'.format(path)) # init runner with codecs.open(path, 'r', 'utf8') as fp: nb = read(fp, IPYNB_VER) r = NotebookRunner(nb) r.clear_outputs() # run config & startup run_init(r, path) # run cells cellcnt = r.cellcnt rundb.start_run(path, cellcnt) err = None memory_used = [] try: r.run_notebook(memory_used, lambda cur: _progress_cell(path, cur)) run_code(r, "if 'manifest_' in globals() and manifest_ is not None: " "manifest_._check_output_hdf()") except NotebookError, e: logging.debug("except NotebookError") err = unicode(e)
def _write_result(self, elapsed, max_mem, err): logging.debug(u'_write_result {}'.format(self._path)) with codecs.open(self._path, 'r', 'utf8') as fp: nb = read(fp, IPYNB_VER) logging.debug(nb) nr = NotebookRunner(nb) try: nr.run_notebook() except NotebookError, e: merr = unicode(e) logging.error(merr)