コード例 #1
0
ファイル: ipynb_runner.py プロジェクト: haje01/wzdat
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)
コード例 #2
0
ファイル: nbdependresolv.py プロジェクト: haje01/wzdat
 def _clear_externally_stopped(self):
     for nb in self.notebooks:
         path = nb.path
         # reset run info if previous run stopped externally
         info = get_run_info(path)
         if info is not None:
             start, elapsed, cur, total, error = info
             if error is None and cur > 0 and elapsed is None:
                 reset_run(path)