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

Add kwargs to pass to docker container that runs the Jupyter Server #3028

Merged
merged 6 commits into from
Sep 25, 2024
Merged
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 autogen/coding/jupyter/docker_jupyter_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import uuid
from pathlib import Path
from types import TracebackType
from typing import Dict, Optional, Type, Union
from typing import Any, Dict, Optional, Type, Union

import docker

Expand Down Expand Up @@ -59,6 +59,7 @@ def __init__(
stop_container: bool = True,
docker_env: Dict[str, str] = {},
token: Union[str, GenerateToken] = GenerateToken(),
**docker_kwargs: Any,
):
"""Start a Jupyter kernel gateway server in a Docker container.

Expand All @@ -77,6 +78,7 @@ def __init__(
token (Union[str, GenerateToken], optional): Token to use for authentication.
If GenerateToken is used, a random token will be generated. Empty string
will be unauthenticated.
docker_kwargs (Any): Additional keyword arguments to pass to the docker container.
"""
if container_name is None:
container_name = f"autogen-jupyterkernelgateway-{uuid.uuid4()}"
Expand Down Expand Up @@ -118,6 +120,7 @@ def __init__(
environment=env,
publish_all_ports=True,
name=container_name,
**docker_kwargs,
)
_wait_for_ready(container)
container_ports = container.ports
Expand Down
Loading