Skip to content

Commit 377f5fc

Browse files
authored
Merge pull request #605 from FlorentinD/error-out-on-run-nbs
Fail run-notebooks on error
2 parents 0a6d2a8 + 2628ae5 commit 377f5fc

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

scripts/run_notebooks.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ def main(run_session_nbs: bool) -> None:
7070

7171
ep = GdsExecutePreprocessor(kernel_name="python3")
7272
td_collector = GdsTearDownCollector(kernel_name="python3")
73+
exceptions: List[RuntimeError] = []
7374

7475
for notebook_filename in notebook_files:
7576
now = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
@@ -98,9 +99,14 @@ def main(run_session_nbs: bool) -> None:
9899
try:
99100
ep.preprocess(nb)
100101
except CellExecutionError as e:
101-
print(f"Error executing notebook {notebook_filename}: {e}")
102+
exceptions.append(RuntimeError(f"Error executing notebook {notebook_filename}", e))
102103
continue
103104

105+
if exceptions:
106+
for nb_ex in exceptions:
107+
print(nb_ex)
108+
raise RuntimeError(f"{len(exceptions)} Errors occurred while executing notebooks")
109+
else:
104110
print(f"Finished executing notebook {notebook_filename}")
105111

106112

0 commit comments

Comments
 (0)