Skip to content

Commit

Permalink
added no-browser (headless) option to run jupyter notebooks on VM. (s…
Browse files Browse the repository at this point in the history
…ecurefederatedai#1054)

* added no-browser option
  • Loading branch information
tanwarsh committed Nov 18, 2024
1 parent 38ef1d5 commit 7c9864a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions openfl/interface/tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,19 @@ def tutorial(context):
type=IntRange(1, 65535),
help="The port the Jupyter Lab server will listen on",
)
def start(ip, port):
@option(
"-no-browser/--browser",
"--no-browser/--browser",
default=False,
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 +78,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)

0 comments on commit 7c9864a

Please sign in to comment.