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

added no-browser (headless) option to run jupyter notebooks on VM. #1054

Merged
13 changes: 11 additions & 2 deletions openfl/interface/tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,20 @@ def tutorial(context):
type=IntRange(1, 65535),
help="The port the Jupyter Lab server will listen on",
)
def start(ip, port):
@option(
"-no-browser",
"--no-browser",
required=False,
type=bool,
help="If True, the server will not use the default web browser",
)
def start(ip, port, no_browser):
"""Start the Jupyter Lab from the tutorials directory.

Args:
ip (str): IP address the Jupyter Lab that should start.
port (int): The port the Jupyter Lab server will listen on.
no_browser (bool): If True, the server will not open the default web browser.
"""

if "VIRTUAL_ENV" in environ:
Expand All @@ -71,5 +79,6 @@ def start(ip, port):
jupyter_command += ["--ip", f"{ip}"]
if port is not None:
jupyter_command += ["--port", f"{port}"]

if no_browser:
jupyter_command += ["--no-browser"]
check_call(jupyter_command)
Loading