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

fix: put back docstrings for launching sessions #1929

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
5 changes: 4 additions & 1 deletion renku_notebooks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
check_docker_image,
launch_notebook,
patch_server,
renku_2_launch_notebook_helper,
server_logs,
server_options,
stop_server,
Expand All @@ -38,7 +39,7 @@
from .api.schemas.logs import ServerLogs
from .api.schemas.servers_get import NotebookResponse, ServersGetRequest, ServersGetResponse
from .api.schemas.servers_patch import PatchServerRequest
from .api.schemas.servers_post import LaunchNotebookRequest
from .api.schemas.servers_post import LaunchNotebookRequest, Renku2LaunchNotebookRequest
from .api.schemas.version import VersionResponse
from .config import config as config
from .errors.utils import handle_exception
Expand Down Expand Up @@ -130,6 +131,7 @@ def register_swagger(app):
)
# Register schemas
spec.components.schema("LaunchNotebookRequest", schema=LaunchNotebookRequest)
spec.components.schema("Renku2LaunchNotebookRequest", schema=Renku2LaunchNotebookRequest)
spec.components.schema("NotebookResponse", schema=NotebookResponse)
spec.components.schema("PatchServerRequest", schema=PatchServerRequest)
spec.components.schema("ServersGetRequest", schema=ServersGetRequest)
Expand All @@ -148,6 +150,7 @@ def register_swagger(app):
spec.path(view=server_options)
spec.path(view=server_logs)
spec.path(view=check_docker_image)
spec.path(view=renku_2_launch_notebook_helper)
# Register security scheme
security_scheme = {
"type": "openIdConnect",
Expand Down
56 changes: 56 additions & 0 deletions renku_notebooks/api/notebooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,34 @@ def launch_notebook(
server_options=None,
user_secrets=None,
):
"""Launch a Jupyter server.

---
post:
description: Start a server.
requestBody:
content:
application/json:
schema: LaunchNotebookRequest
responses:
200:
description: The server exists and is already running.
content:
application/json:
schema: NotebookResponse
201:
description: The requested server has been created.
content:
application/json:
schema: NotebookResponse
404:
description: The server could not be launched.
content:
application/json:
schema: ErrorResponse
tags:
- servers
"""
server_name = renku_1_make_server_name(user.safe_username, namespace, project, branch, commit_sha)
gl_project = user.get_renku_project(f"{namespace}/{project}")
gl_project_path = gl_project.path
Expand Down Expand Up @@ -244,6 +272,34 @@ def renku_2_launch_notebook_helper(
launcher_id: str | None = None, # Renku 2
repositories: list[dict[str, str]] | None = None, # Renku 2
):
"""Launch a Jupyter server using the new API.

---
post:
description: Start a server.
requestBody:
content:
application/json:
schema: Renku2LaunchNotebookRequest
responses:
200:
description: The server exists and is already running.
content:
application/json:
schema: NotebookResponse
201:
description: The requested server has been created.
content:
application/json:
schema: NotebookResponse
404:
description: The server could not be launched.
content:
application/json:
schema: ErrorResponse
tags:
- servers
"""
server_name = renku_2_make_server_name(
safe_username=user.safe_username, project_id=project_id, launcher_id=launcher_id
)
Expand Down
Loading