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

tbdev turndown: replace dev subcommand with shim #6707

Merged
merged 2 commits into from
Jan 5, 2024
Merged
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
2 changes: 0 additions & 2 deletions tensorboard/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ py_binary(
":program",
"//tensorboard:expect_tensorflow_installed",
"//tensorboard/plugins:base_plugin",
"//tensorboard/uploader:uploader_subcommand",
"//tensorboard/util:tb_logging",
"//tensorboard/util:timing", # non-strict dep, for patching convenience
],
Expand Down Expand Up @@ -62,7 +61,6 @@ py_binary(
":lib",
":main_lib",
":program",
"//tensorboard/uploader:uploader_subcommand",
],
)

Expand Down
7 changes: 1 addition & 6 deletions tensorboard/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
from tensorboard import main_lib
from tensorboard import program
from tensorboard.plugins import base_plugin
from tensorboard.uploader import uploader_subcommand
from tensorboard.util import tb_logging

logger = tb_logging.get_logger()
Expand All @@ -37,11 +36,7 @@
def run_main():
"""Initializes flags and calls main()."""
main_lib.global_init()

tensorboard = program.TensorBoard(
plugins=default.get_plugins(),
subcommands=[uploader_subcommand.UploaderSubcommand()],
)
tensorboard = program.TensorBoard(plugins=default.get_plugins())
try:
app.run(tensorboard.main, flags_parser=tensorboard.configure)
except base_plugin.FlagsError as e:
Expand Down
2 changes: 0 additions & 2 deletions tensorboard/main_dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from tensorboard import main_lib
from tensorboard import program
from tensorboard.plugins import base_plugin
from tensorboard.uploader import uploader_subcommand


def run_main():
Expand All @@ -33,7 +32,6 @@ def run_main():
tensorboard = program.TensorBoard(
plugins=default.get_plugins(),
assets_zip_provider=lambda: open(path, "rb"),
subcommands=[uploader_subcommand.UploaderSubcommand()],
)

try:
Expand Down
16 changes: 16 additions & 0 deletions tensorboard/main_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@
from tensorboard.compat import tf


_TBDEV_SHUTDOWN_MESSAGE = """\
======================================================================
ERROR: The `tensorboard dev` command is no longer available.

TensorBoard.dev has been shut down. For further information,
see the FAQ at <https://tensorboard.dev/>.
======================================================================
"""


def global_init():
"""Modifies the global environment for running TensorBoard as main.

Expand All @@ -45,3 +55,9 @@ def global_init():

# Only emit log messages at WARNING and above by default to reduce spam.
absl.logging.set_verbosity(absl.logging.WARNING)

# Intercept attempts to invoke `tensorboard dev` and print turndown message.
if sys.argv[1:] and sys.argv[1] == "dev":
sys.stderr.write(_TBDEV_SHUTDOWN_MESSAGE)
sys.stderr.flush()
sys.exit(1)
Loading