Skip to content

Commit

Permalink
Remove magic notebook exclude dir
Browse files Browse the repository at this point in the history
  • Loading branch information
fajpunk committed May 20, 2024
1 parent 8e3f112 commit f006b15
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 149 deletions.
4 changes: 0 additions & 4 deletions src/mobu/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,13 @@
from datetime import timedelta

__all__ = [
"NOTEBOOK_ALWAYS_EXCLUDE_DIRS",
"NOTEBOOK_REPO_URL",
"NOTEBOOK_REPO_BRANCH",
"TOKEN_LIFETIME",
"USERNAME_REGEX",
"WEBSOCKET_OPEN_TIMEOUT",
]

NOTEBOOK_ALWAYS_EXCLUDE_DIRS = {"mobu_exclude"}
"""NotebookRunner always excludes notebooks in these dirs."""

NOTEBOOK_REPO_URL = "https://github.com/lsst-sqre/notebook-demo.git"
"""Default notebook repository for NotebookRunner."""

Expand Down
8 changes: 1 addition & 7 deletions src/mobu/models/business/notebookrunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@

from pydantic import Field

from ...constants import (
NOTEBOOK_ALWAYS_EXCLUDE_DIRS,
NOTEBOOK_REPO_BRANCH,
NOTEBOOK_REPO_URL,
)
from ...constants import NOTEBOOK_REPO_BRANCH, NOTEBOOK_REPO_URL
from .base import BusinessConfig
from .nublado import NubladoBusinessData, NubladoBusinessOptions

Expand Down Expand Up @@ -59,8 +55,6 @@ class NotebookRunnerOptions(NubladoBusinessOptions):
description=(
" These directories are relative to the repo root. Any notebooks"
" in child directories of these directories will also be excluded."
" Regardless of this value, notebooks in these dirs will always"
f" be excluded: {NOTEBOOK_ALWAYS_EXCLUDE_DIRS}"
" Only used by the NotebookRunner."
),
examples=["some-dir", "some-dir/some-other-dir"],
Expand Down
4 changes: 1 addition & 3 deletions src/mobu/services/business/notebookrunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from httpx import AsyncClient
from structlog.stdlib import BoundLogger

from ...constants import NOTEBOOK_ALWAYS_EXCLUDE_DIRS
from ...exceptions import NotebookRepositoryError
from ...models.business.notebookrunner import (
NotebookRunnerData,
Expand Down Expand Up @@ -74,9 +73,8 @@ async def startup(self) -> None:
if self._repo_dir is None:
self._repo_dir = Path(TemporaryDirectory().name)
await self.clone_repo()
exclude_dirs = self.options.exclude_dirs | NOTEBOOK_ALWAYS_EXCLUDE_DIRS
self._exclude_paths = {
(self._repo_dir / path) for path in exclude_dirs
(self._repo_dir / path) for path in self.options.exclude_dirs
}
self._notebook_paths = self.find_notebooks()
self.logger.info("Repository cloned and ready")
Expand Down
6 changes: 0 additions & 6 deletions tests/business/notebookrunner_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,6 @@ async def test_run_recursive(
assert "Another test double-nested-dir" in r.text
assert "Final test double-nested-dir" in r.text

# always excluded notebook
assert "This should never run." not in r.text

# Exceptions
assert "Exception thrown" not in r.text

Expand Down Expand Up @@ -297,9 +294,6 @@ async def test_exclude_dirs(
# nested-dir notebook
assert "Test double-nested-dir" not in r.text

# always excluded notebook
assert "This should never run." not in r.text

# Exceptions
assert "Exception thrown" not in r.text

Expand Down

This file was deleted.

0 comments on commit f006b15

Please sign in to comment.