def test_notebook_error(): path = os.path.join(get_notebook_dir(), 'test-notebook-error.ipynb') assert os.path.isfile(path) try: update_notebook_by_run(path) except ValueError: pass assert check_notebook_error_and_changed(path) == (True, False) touch(path) assert check_notebook_error_and_changed(path) == (True, True) from wzdat import rundb redis_ri = rundb.get_run_info(path) rundb.remove_run_info(path) manifest_ri = get_run_info(path) # both elapsed time is equal assert redis_ri[1] == manifest_ri[1] # both error msg is equal assert redis_ri[-1] == manifest_ri[-1]
def _run_resolved(self, updaterun, notebook, resolved, runs): '''Run notebook after all its dependencies resolved.''' logging.debug(u"_run_resolved '{}'".format(notebook.path)) notebook.reload_manifest() path = notebook.path # Only run when dependecies changed and notebook has no error or # changed error, changed = check_notebook_error_and_changed(path) logging.debug("nb error {}, nb changed {}".format(error, changed)) if updaterun: # run notebook when its depends changed or had fixed after error if notebook.manifest._need_run: # or (error and changed): try: update_notebook_by_run(path) except NoDataFound, e: logging.debug(unicode(e)) runs.append(notebook) elif error and not changed: logging.debug(u"_run_resolved - skip unfixed {}".format(path)) else: logging.debug(u"no need to run")