Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-42225: Drop support for cachemachine #323

Merged
merged 1 commit into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions changelog.d/20231214_165219_rra_DM_42182.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
### Backwards-incompatible changes
### Other changes

- All environment variables used to configure mobu now start with `MOBU_`, and several have changed their names. The new settings are `MOBU_ALERT_HOOK`, `MOBU_AUTOSTART_PATH`, `MOBU_ENVIRONMENT_URL`, `MOBU_GAFAELFAWR_TOKEN`, `MOBU_NAME`, `MOBU_PATH_PREFIX`, `MOBU_LOGGING_PROFILE`, and `MOBU_LOG_LEVEL`.
- All environment variables used to configure mobu now start with `MOBU_`, and several have changed their names. The new settings are `MOBU_ALERT_HOOK`, `MOBU_AUTOSTART_PATH`, `MOBU_ENVIRONMENT_URL`, `MOBU_GAFAELFAWR_TOKEN`, `MOBU_NAME`, `MOBU_PATH_PREFIX`, `MOBU_LOGGING_PROFILE`, and `MOBU_LOG_LEVEL`. This is handled by the Phalanx application, so no configuration changes should be required.
3 changes: 3 additions & 0 deletions changelog.d/20231215_143527_rra_DM_42225.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Backwards-incompatible changes

- Drop support for cachemachine and Nublado v2. The `cachemachine_image_policy` and `use_cachemachine` configuration options are no longer supported and should be deleted.
8 changes: 0 additions & 8 deletions src/mobu/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"""Regex that matches ANSI escape sequences."""

__all__ = [
"CachemachineError",
"CodeExecutionError",
"FlockNotFoundError",
"GafaelfawrParseError",
Expand Down Expand Up @@ -276,13 +275,6 @@ class NotebookRepositoryError(MobuSlackException):
"""The repository containing notebooks to run is not valid."""


class CachemachineError(MobuSlackException):
"""Failed to obtain a valid image list from cachemachine."""

def __init__(self, msg: str) -> None:
super().__init__(f"Cachemachine error: {msg}")


class CodeExecutionError(MobuSlackException):
"""Error generated by code execution in a notebook on JupyterLab."""

Expand Down
31 changes: 0 additions & 31 deletions src/mobu/models/business/nublado.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from .base import BusinessData, BusinessOptions

__all__ = [
"CachemachinePolicy",
"NubladoBusinessData",
"NubladoBusinessOptions",
"NubladoImage",
Expand All @@ -24,13 +23,6 @@
]


class CachemachinePolicy(Enum):
"""Policy for what eligible images to retrieve from cachemachine."""

available = "available"
desired = "desired"


class NubladoImageClass(str, Enum):
"""Possible ways of selecting an image."""

Expand Down Expand Up @@ -149,19 +141,6 @@ def to_spawn_form(self) -> dict[str, str]:
class NubladoBusinessOptions(BusinessOptions):
"""Options for any business that runs code in a Nublado lab."""

cachemachine_image_policy: CachemachinePolicy = Field(
CachemachinePolicy.available,
title="Class of cachemachine images to use",
description=(
"Whether to use the images available on all nodes, or the images"
" desired by cachemachine. In instances where image streaming is"
" enabled and therefore pulls are fast, ``desired`` is preferred."
" The default is ``available``. Only used if ``use_cachemachine``"
" is true."
),
examples=[CachemachinePolicy.desired],
)

delete_lab: bool = Field(
True,
title="Whether to delete the lab between iterations",
Expand Down Expand Up @@ -250,16 +229,6 @@ class NubladoBusinessOptions(BusinessOptions):

url_prefix: str = Field("/nb/", title="URL prefix for JupyterHub")

use_cachemachine: bool = Field(
True,
title="Whether to use cachemachine to look up an image",
description=(
"Set this to false in environments using the new Nublado lab"
" controller."
),
examples=[False],
)

working_directory: str | None = Field(
None,
title="Working directory when running code",
Expand Down
12 changes: 0 additions & 12 deletions src/mobu/services/business/nublado.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
RunningImage,
)
from ...models.user import AuthenticatedUser
from ...storage.cachemachine import CachemachineClient
from ...storage.nublado import JupyterLabSession, NubladoClient
from .base import Business

Expand Down Expand Up @@ -108,20 +107,9 @@ def __init__(
if not config.environment_url:
raise RuntimeError("environment_url not set")
environment_url = str(config.environment_url).rstrip("/")
cachemachine = None
if options.use_cachemachine:
if not config.gafaelfawr_token:
raise RuntimeError("GAFAELFAWR_TOKEN not set")
cachemachine = CachemachineClient(
url=environment_url + "/cachemachine/jupyter",
token=config.gafaelfawr_token,
http_client=http_client,
image_policy=options.cachemachine_image_policy,
)
self._client = NubladoClient(
user=user,
base_url=environment_url + options.url_prefix,
cachemachine=cachemachine,
logger=logger,
timeout=options.jupyter_timeout,
)
Expand Down
174 changes: 0 additions & 174 deletions src/mobu/storage/cachemachine.py

This file was deleted.

Loading