Skip to content

Commit

Permalink
Merge pull request #121 from lsst-sqre/tickets/DM-33742
Browse files Browse the repository at this point in the history
DM-33742: Introduce cachemachine_image_policy to mobu
  • Loading branch information
athornton authored Feb 28, 2022
2 parents 6e7aa97 + e766f2e commit 6a47c2f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/mobu/cachemachine.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from __future__ import annotations

from typing import TYPE_CHECKING
from urllib.parse import urljoin

from .config import config
from .exceptions import CachemachineError
Expand All @@ -30,8 +29,11 @@ def __init__(
self._session = session
self._token = token
self._username = username
self._url = urljoin(
config.environment_url, "cachemachine/jupyter/available"
# Should be configurable between available and desired
self._url = (
config.environment_url
+ "/cachemachine/jupyter/"
+ config.cachemachine_image_policy
)

async def get_latest_weekly(self) -> JupyterImage:
Expand Down
11 changes: 11 additions & 0 deletions src/mobu/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,17 @@ class Configuration:
Set with the ``ENVIRONMENT_URL`` environment variable.
"""

cachemachine_image_policy: str = os.getenv(
"CACHEMACHINE_IMAGE_POLICY", "available"
)
"""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``.
Set with the ``CACHEMACHINE_IMAGE_POLICY`` environment variable.
"""

gafaelfawr_token: Optional[str] = os.getenv("GAFAELFAWR_TOKEN")
"""The Gafaelfawr admin token to use to create user tokens.
Expand Down

0 comments on commit 6a47c2f

Please sign in to comment.