Skip to content

Commit

Permalink
Use external rubin-nublado-client for Jupyter communication.
Browse files Browse the repository at this point in the history
  • Loading branch information
athornton committed Nov 7, 2024
1 parent 058689c commit 053465b
Show file tree
Hide file tree
Showing 19 changed files with 1,555 additions and 2,653 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-yaml
- id: check-toml
- id: trailing-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.4
rev: v0.7.2
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# - Runs a non-root user.
# - Sets up the entrypoint and port.

FROM python:3.12.6-slim-bookworm as base-image
FROM python:3.12.6-slim-bookworm AS base-image

# Update system packages
COPY scripts/install-base-packages.sh .
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ exclude_lines = [


[tool.pytest.ini_options]
asyncio_default_fixture_loop_scope = "function"
asyncio_mode = "strict"
python_files = ["tests/*.py", "tests/*/*.py"]

Expand Down
1,341 changes: 685 additions & 656 deletions requirements/dev.txt

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions requirements/main.in
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ safir[arq]
pydantic
pydantic_settings
PyYAML
rubin-nublado-client
httpx
websockets
humanize
996 changes: 672 additions & 324 deletions requirements/main.txt

Large diffs are not rendered by default.

80 changes: 40 additions & 40 deletions requirements/tox.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ colorama==0.4.6 \
--hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \
--hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6
# via tox
distlib==0.3.8 \
--hash=sha256:034db59a0b96f8ca18035f36290806a9a6e6bd9d1ff91e45a7f172eb17e51784 \
--hash=sha256:1530ea13e350031b6312d8580ddb6b27a104275a31106523b8f123787f494f64
distlib==0.3.9 \
--hash=sha256:47f8c22fd27c27e25a65601af709b38e4f0a45ea4fc2e710f65755fa8caaaf87 \
--hash=sha256:a60f20dea646b8a33f3e7772f74dc0b2d0772d2837ee1342a00645c81edf9403
# via
# -c requirements/dev.txt
# virtualenv
filelock==3.15.4 \
--hash=sha256:2207938cbc1844345cb01a5a95524dae30f0ce089eba5b00378295a17e3e90cb \
--hash=sha256:6ca1fffae96225dab4c6eaf1c4f4f28cd2568d3ec2a44e15a08520504de468e7
filelock==3.16.1 \
--hash=sha256:2082e5703d51fbf98ea75855d9d5527e33d8ff23099bec374a134febee6946b0 \
--hash=sha256:c249fbfcd5db47e5e2d6d62198e565475ee65e4831e2561c8e313fa7eb961435
# via
# -c requirements/dev.txt
# tox
Expand All @@ -34,9 +34,9 @@ packaging==24.1 \
# pyproject-api
# tox
# tox-uv
platformdirs==4.2.2 \
--hash=sha256:2d7a1657e36a80ea911db832a8a6ece5ee53d8de21edd5cc5879af6530b1bfee \
--hash=sha256:38b7b51f512eed9e84a22788b4bce1de17c0adb134d6becb09836e37d8654cd3
platformdirs==4.3.6 \
--hash=sha256:357fb2acbc885b0419afd3ce3ed34564c13c9b95c89360cd9563f73aa5e2b907 \
--hash=sha256:73e575e1408ab8103900836b97580d5307456908a03e92031bab39e4554cc3fb
# via
# -c requirements/dev.txt
# tox
Expand All @@ -47,43 +47,43 @@ pluggy==1.5.0 \
# via
# -c requirements/dev.txt
# tox
pyproject-api==1.7.1 \
--hash=sha256:2dc1654062c2b27733d8fd4cdda672b22fe8741ef1dde8e3a998a9547b071eeb \
--hash=sha256:7ebc6cd10710f89f4cf2a2731710a98abce37ebff19427116ff2174c9236a827
pyproject-api==1.8.0 \
--hash=sha256:3d7d347a047afe796fd5d1885b1e391ba29be7169bd2f102fcd378f04273d228 \
--hash=sha256:77b8049f2feb5d33eefcc21b57f1e279636277a8ac8ad6b5871037b243778496
# via tox
tox==4.18.0 \
--hash=sha256:0a457400cf70615dc0627eb70d293e80cd95d8ce174bb40ac011011f0c03a249 \
--hash=sha256:5dfa1cab9f146becd6e351333a82f9e0ade374451630ba65ee54584624c27b58
tox==4.23.2 \
--hash=sha256:452bc32bb031f2282881a2118923176445bac783ab97c874b8770ab4c3b76c38 \
--hash=sha256:86075e00e555df6e82e74cfc333917f91ecb47ffbc868dcafbd2672e332f4a2c
# via
# -r requirements/tox.in
# tox-uv
tox-uv==1.11.2 \
--hash=sha256:7f8f1737b3277e1cddcb5b89fcc5931d04923562c940ae60f29e140908566df2 \
--hash=sha256:a7aded5c3fb69f055b523357988c1055bb573e91bfd7ecfb9b5233ebcab5d10b
tox-uv==1.16.0 \
--hash=sha256:71b2e2fa6c35c1360b91a302df1d65b3e5a1f656b321c5ebf7b84545804c9f01 \
--hash=sha256:e6f0b525a687e745ab878d07cbf5c7e85d582028d4a7c8935f95e84350651432
# via -r requirements/tox.in
uv==0.4.6 \
--hash=sha256:081793fc66286ad0f9b939b5ab3239d20d486eff7b8f7c574d3fdcd44536595e \
--hash=sha256:16ae9f0a9b3bb6db755d057c4ff55b0e82fbb09243a1dce02720268718c0a11c \
--hash=sha256:2bd9879eb8ee9de0fa532136ddfe76c1b425520fa6de52f5d023567e226a08b5 \
--hash=sha256:346db85ce897c6c782af33504922a84c583180906244ea224a306e2393f396f4 \
--hash=sha256:397e02640cbddc4230da8d614ef9a7138a024b9ce396f2a27013cd254e97480d \
--hash=sha256:4db5c2b770bb0e95a4d32dc19943109310c86103fe8b8ecf0d18dfe1a4f2a212 \
--hash=sha256:5c142b0082844c9eca4a303e13cf1d286622f49af70e8f922b833cb3e667b2e3 \
--hash=sha256:5d507dee4767d054171dcdbc1ac1fa7d15a7579e20ff988162c749f09a95f943 \
--hash=sha256:831be24db75938ebb01f9e6b7bcf24683b9661f91aab4108636207ba9dc6a2b9 \
--hash=sha256:86ecd19796363f0161600120d81ce7e3d17d54cce6d25017190daa608a8ab535 \
--hash=sha256:86f78fb80989b524ce7da705fb5af613339a8eadbcf9e230bb16e8a7d383c2ce \
--hash=sha256:93165aa25f5278a0844c91a367140e725d384633946705651ff8e70757c2e92f \
--hash=sha256:954f91be1b8e531e9fd3d6d549ec1638c20ce4e77dc6e272c5c5d21b8c952f11 \
--hash=sha256:9bf486c6331197a301bff253945b233d852ed2fdc322e93c78d382092813161d \
--hash=sha256:a66442018e09467222824b685b2d401053dfdbc3b5f6fb1f863ca2eb2560076a \
--hash=sha256:b8cdadb99b842494a0a39e0184cacfb4af722fdbea3d4cb5ee3b25ea0b824292 \
--hash=sha256:e0360bb3b094d106d1fa00b3a15c69ccd0d1593682c33affb1b94367a248a378 \
--hash=sha256:e6e925f661aeaf392cc102d3c2f6f05b6994519bd7a36578f836a4bbf42ee813
uv==0.4.29 \
--hash=sha256:0be21afa0e582ddc5badff6ef40c3c6784efc5feae4ad568307b668d40dc49bd \
--hash=sha256:246da468ac0d51e7fb257cd038db2f8d6376ae269a44d01f56776e32108aa9da \
--hash=sha256:24cccff9c248864ba0ab3429bae56314146c9494ce66a881d70ea8cf2805945f \
--hash=sha256:287dc3fd3f78093a5a82136f01cbd9f224e0905b38d3dcffdc96c08fbbe48ee9 \
--hash=sha256:3473b05142ba436ac30d036b7ab5e9bcfa97f63df5d1382f92e0a3e4aaa391bc \
--hash=sha256:668d3e6095c6f0cac6a831ef4030f7ad79442d1c84b9569f01f50b60c2d51a77 \
--hash=sha256:67dcfd253020e25ed1c49e5bd06406205c37264f99e14002de53a357cd1cdadf \
--hash=sha256:68d4967b5f0af8bd46085e0f3ded229026700668a97734a21c3d11a5fc350c47 \
--hash=sha256:6b03859068aaa08ca9907a51d403d54b0a9d8054091646845a9192f213f099d4 \
--hash=sha256:7060dfbad0bc26e9cecbb4f8482445c958071511f23728948478f81acfb29048 \
--hash=sha256:75927da78f74bb935314d236dc61ecdc192e878e06eb79585b6d9d5ee9829f98 \
--hash=sha256:8c71663c7df4f512c697de39a4926dc191897f5fede73644bb2329f532c1ebfa \
--hash=sha256:950bbfe1954e9c3a5d6c4777bb778b4c23d0dea9ad9f77622c45d4fbba433355 \
--hash=sha256:9c559b6fdc042add463e86afa1c210716f7020bfc2e96b00df5af7afcb587ce7 \
--hash=sha256:b5775db128b98251c3ea7874367fc20dce9f9aac3dbfa635e3ef4a1c56842d9c \
--hash=sha256:cfb797a87b55d96cc0593e9f29ab5d58454be74598ea0158e1b2f4f2dc97cede \
--hash=sha256:df35d9cbe4cfbb7bce287f56e3bb7a7cef0b7b5173ed889d936d4c470f2b1b83 \
--hash=sha256:f6224a322267570e0470c61008fd1c8e2f50bf073b339f4c3010da86aef3c44c
# via tox-uv
virtualenv==20.26.3 \
--hash=sha256:4c43a2a236279d9ea36a0d76f98d84bd6ca94ac4e0f4a3b9d46d05e10fea542a \
--hash=sha256:8cc4a31139e796e9a7de2cd5cf2489de1217193116a8fd42328f1bd65f434589
virtualenv==20.27.1 \
--hash=sha256:142c6be10212543b32c6c45d3d3893dff89112cc588b7d0879ae5a1ec03a47ba \
--hash=sha256:f11f1b8a29525562925f745563bfd48b189450f61fb34c4f9cc79dd5aa32a1f4
# via
# -c requirements/dev.txt
# tox
18 changes: 7 additions & 11 deletions src/noteburst/handlers/v1/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,15 @@
from enum import Enum
from typing import Annotated, Any

import rubin.nublado.client.models as nc_models
from arq.jobs import JobStatus
from fastapi import Request
from pydantic import AnyHttpUrl, BaseModel, Field
from rubin.nublado.client.models._extension import NotebookExecutionErrorModel
from safir.arq import JobMetadata, JobResult
from safir.pydantic import HumanTimedelta

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

kernel_name_field = Field(
"LSST",
Expand All @@ -41,7 +39,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,14 +183,12 @@ 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_error = NotebookError.from_nbexec_error(
nbexec_result.error
)
ipynb = res.notebook
if res.error:
ipynb_error = NotebookError.from_nbexec_error(res.error)
else:
ipynb_error = None
else:
Expand Down
Empty file.
Loading

0 comments on commit 053465b

Please sign in to comment.