Skip to content

Commit e9a6bb0

Browse files
test: speed up parallel_ensembles.ipynb
1 parent 50d76ad commit e9a6bb0

File tree

2 files changed

+265
-75
lines changed

2 files changed

+265
-75
lines changed

notebooks/parallel_ensembles.ipynb

Lines changed: 252 additions & 74 deletions
Large diffs are not rendered by default.

tasks.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,20 @@ def clean(ctx: Context):
161161
"parallel": "Run the notebooks in parallel.",
162162
"overwrite": "Overwrite the notebooks with the executed output.",
163163
"pattern": "Run only the notebooks that match the pattern. Same as `pytest -k`",
164+
"fast": (
165+
"Run the notebooks in fast mode by setting the environment variable "
166+
"`NB_FAST` to `true`. You cannot use this option with `--overwrite`."
167+
),
168+
"no_skip": "Do not skip any notebooks.",
164169
}
165170
)
166171
def test_notebooks(
167172
ctx: Context,
168173
parallel: bool = True,
169174
overwrite: bool = False,
170175
pattern: Optional[str] = None,
176+
fast: bool = True,
177+
no_skip: bool = False,
171178
):
172179
"""Run the notebooks and check for errors.
173180
@@ -176,9 +183,14 @@ def test_notebooks(
176183
with the executed output.
177184
178185
"""
186+
assert not (fast and overwrite), "You cannot use `--overwrite` with `--fast`."
187+
188+
# Set the environment variable to run the notebooks in fast mode.
189+
if fast:
190+
environ["NB_FAST"] = "true"
179191

180192
skip_notebooks = ctx["test_skip_notebooks"]
181-
if skip_notebooks is None:
193+
if skip_notebooks is None or no_skip:
182194
skip_notebooks = []
183195
print(f"Skipping notebooks: {skip_notebooks}")
184196
cmd = [

0 commit comments

Comments
 (0)