Skip to content

[OpenSTEF 4.0] Optimize tutorial notebooks for CI execution #886

@egordm

Description

@egordm

Context

PR #885 integrates myst-nb notebook rendering infrastructure. Notebooks currently render as static code (no outputs) because execution exceeds the 120s timeout.

Parent: #883

Goal

Optimize tutorials so they execute within 120s, then flip nb_execution_mode from "off" to "cache" so rendered docs show actual outputs.

Tasks

Notebooks that can be made fast

  • forecasting_with_workflow_presets.py: Reduce dataset to ~14 days, use minimal model params (n_estimators=10)
  • hyperparameter_tuning_with_optuna.py: Use create_synthetic_forecasting_dataset(length=timedelta(days=14)), reduce to 3 Optuna trials

Notebooks that cannot be made fast

  • backtesting_openstef_with_beam.py: Move to examples/benchmarks/ (not rendered in docs). Create a simpler "backtesting quickstart" tutorial that demonstrates the API with 1-2 horizons and a tiny dataset

Rendering quality

  • Switch all tutorial plotting to PNG-based matplotlib backend (%matplotlib inline or matplotlib.use("agg")) — avoid interactive HTML plots (plotly/bokeh) which produce large outputs and render poorly in static docs
  • Add disclaimer at top of each tutorial: "Uses minimal data for fast execution. See examples/benchmarks/ for production-scale runs."

Infra

  • Enable nb_execution_mode = "cache" in docs/source/conf.py
  • Add .jupyter_cache/ to GitHub Actions cache for faster CI builds
  • Set timeout to 120s (already configured)
  • Verify poe docs builds with outputs in < 3 minutes total

Constraints

  • Each notebook must complete execution within 120 seconds
  • No interactive HTML widgets in output (PNG plots only)
  • create_synthetic_forecasting_dataset is the preferred data source for tutorials
  • Backtesting benchmark stays in examples/benchmarks/ — NOT in docs toctree

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions