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):
@@ -39,20 +39,40 @@ class WfBrainscales2Demos(Package):
def install(self, spec, prefix):
def install(self, spec, prefix):
install_tree(".", join_path(prefix, "notebooks"))
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):
def _run_notebooks(self, output_dir):
mkdirp(output_dir)
mkdirp(output_dir)
# execute notebook and save
# try to run all notebooks, then fail if there are errors
jupyter = Executable("jupyter")
exceptions = []
for fn in glob(join_path(prefix, "notebooks", "ts*.ipynb")) + glob(join_path(prefix, "notebooks", "tp*.ipynb")):
for fn in glob(join_path(prefix, "notebooks", "ts*.ipynb")) + glob(join_path(prefix, "notebooks", "tp*.ipynb")):
jupyter("nbconvert",
try:
"--ExecutePreprocessor.kernel_name=python3",
self._nbconvert(fn, join_path(output_dir, os.path.basename(fn)))
"--execute",
except Exception as e:
"--allow-errors",
exceptions.append(e)
"--to",
if exceptions:
"notebook",
raise Exception("Errors during notebook execution")
fn,
"--output",
join_path(output_dir, os.path.basename(fn)))
def _set_collab_things(self):
def _set_collab_things(self):
# enable "EBRAINS lab" mode
# enable "EBRAINS lab" mode
@@ -66,7 +86,8 @@ class WfBrainscales2Demos(Package):
@@ -66,7 +86,8 @@ class WfBrainscales2Demos(Package):
def installcheck(self):
def installcheck(self):
self._set_collab_things()
self._set_collab_things()
# TODO (ECM): Provide a selection of notebooks that perform local-only tests.
# 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):
def test_notebooks(self):
self._set_collab_things()
self._set_collab_things()