Skip to content
Snippets Groups Projects

create new experimental release

Merged Eleni Mathioulaki requested to merge master into experimental_rel
Files
4
@@ -39,20 +39,40 @@ class WfBrainscales2Demos(Package):
def install(self, spec, prefix):
install_tree(".", join_path(prefix, "notebooks"))
def _nbconvert(self, nb, nb_out):
jupyter = Executable("jupyter")
args = [
"nbconvert",
"--ExecutePreprocessor.kernel_name=python3",
"--ExecutePreprocessor.timeout=900",
"--execute",
"--to",
"notebook",
nb,
"--output",
nb_out
]
try:
# execute notebook and save
jupyter(*args, output=str.split, error=str.split)
except ProcessError as e:
# if the notebook execution fails, re-run notebook to produce output with error
# in case of a cell timeout, don't re-run
if "CellTimeoutError" not in e:
jupyter(*(args+["--allow-errors"]))
raise
def _run_notebooks(self, output_dir):
mkdirp(output_dir)
# execute notebook and save
jupyter = Executable("jupyter")
# try to run all notebooks, then fail if there are errors
exceptions = []
for fn in glob(join_path(prefix, "notebooks", "ts*.ipynb")) + glob(join_path(prefix, "notebooks", "tp*.ipynb")):
jupyter("nbconvert",
"--ExecutePreprocessor.kernel_name=python3",
"--execute",
"--allow-errors",
"--to",
"notebook",
fn,
"--output",
join_path(output_dir, os.path.basename(fn)))
try:
self._nbconvert(fn, join_path(output_dir, os.path.basename(fn)))
except Exception as e:
exceptions.append(e)
if exceptions:
raise Exception("Errors during notebook execution")
def _set_collab_things(self):
# enable "EBRAINS lab" mode
@@ -66,7 +86,8 @@ class WfBrainscales2Demos(Package):
def installcheck(self):
self._set_collab_things()
# TODO (ECM): Provide a selection of notebooks that perform local-only tests.
#self._run_notebooks(join_path(self.prefix, ".spack_test_results"))
# self._run_notebooks(join_path(self.stage.path, ".install_time_tests"))
# copy_tree(join_path(self.stage.path, ".install_time_tests"), join_path(self.prefix, '.build'))
def test_notebooks(self):
self._set_collab_things()