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

temp: Log all image references #83

Closed
wants to merge 1 commit into from
Closed
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
3 changes: 2 additions & 1 deletion src/noteburst/jupyterclient/jupyterlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import websockets
from httpx import Cookies, Timeout
from pydantic import BaseModel, Field
from structlog import BoundLogger
from structlog.stdlib import BoundLogger
from websockets.client import WebSocketClientProtocol
from websockets.exceptions import WebSocketException
from websockets.typing import Data as WebsocketData
Expand Down Expand Up @@ -442,6 +442,7 @@ def lab_controller(self) -> LabControllerClient:
http_client=self.http_client,
token=noteburst_config.gafaelfawr_token.get_secret_value(),
url_prefix=noteburst_config.nublado_controller_path_prefix,
logger=self.logger,
)
return self._lab_controller_client

Expand Down
10 changes: 8 additions & 2 deletions src/noteburst/jupyterclient/labcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import httpx
from pydantic import BaseModel, ConfigDict, Field
from structlog.stdlib import BoundLogger

from noteburst.config import config

Expand Down Expand Up @@ -95,7 +96,9 @@ class LabControllerImages(BaseModel):
)
"""Pydantic model configuration."""

def get_by_reference(self, reference: str) -> JupyterImage | None:
def get_by_reference(
self, reference: str, logger: BoundLogger
) -> JupyterImage | None:
"""Get the JupyterImage with a corresponding reference.

Parameters
Expand All @@ -109,6 +112,7 @@ def get_by_reference(self, reference: str) -> JupyterImage | None:
Returns the JupyterImage if found, None otherwise.
"""
for image in self.all:
logger.info("Image reference", image=image.reference)
if reference == image.reference:
return image

Expand Down Expand Up @@ -142,10 +146,12 @@ def __init__(
http_client: httpx.AsyncClient,
token: str,
url_prefix: str,
logger: BoundLogger,
) -> None:
self._http_client = http_client
self._token = token
self._url_prefix = url_prefix
self._logger = logger

async def get_latest_weekly(self) -> JupyterImage:
"""Image for the latest weekly version.
Expand Down Expand Up @@ -200,7 +206,7 @@ async def get_by_reference(self, reference: str) -> JupyterImage:
An error occurred talking to JupyterLab Controller.
"""
images = await self._get_images()
image = images.get_by_reference(reference)
image = images.get_by_reference(reference, logger=self._logger)
if image is None:
raise LabControllerError(
f"No image with reference {reference} found."
Expand Down