Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
athornton committed Nov 4, 2024
1 parent 28b9360 commit 0c5a1e6
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 1,246 deletions.
19 changes: 10 additions & 9 deletions src/noteburst/handlers/v1/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
from safir.pydantic import HumanTimedelta

from noteburst.exceptions import NbexecTaskError, NbexecTaskTimeoutError
from noteburst.jupyterclient.jupyterlab import (
NotebookExecutionErrorModel,
NotebookExecutionResult,
)

import rubin.nublado.client.models as nc_models

from rubin.nublado.client.models._extension import NotebookExecutionErrorModel # noqa -- fix later


kernel_name_field = Field(
"LSST",
Expand All @@ -41,7 +42,7 @@ class NotebookError(BaseModel):
def from_nbexec_error(
cls, error: NotebookExecutionErrorModel
) -> NotebookError:
"""Create a NotebookError from a NotebookExecutionErrorModel, which
"""Create a NotebookError from NotebookExecutionErrorModel, which
is the result of execution in ``/user/:username/rubin/execute``.
"""
return cls(
Expand Down Expand Up @@ -185,13 +186,13 @@ async def from_job_metadata(
# might have still raised an exception which is part of
# nbexec_result.error and we want to pass that back to the user.
if job_result is not None and job_result.success:
nbexec_result = NotebookExecutionResult.model_validate_json(
res = nc_models.NotebookExecutionResult.model_validate_json(
job_result.result
)
ipynb = nbexec_result.notebook
if nbexec_result.error:
ipynb = res.notebook
if res.error:
ipynb_error = NotebookError.from_nbexec_error(
nbexec_result.error
res.error
)
else:
ipynb_error = None
Expand Down
Empty file.
Loading

0 comments on commit 0c5a1e6

Please sign in to comment.