From d0522a64ae1ad3d5b4a5580aa249bf333f8e4dc3 Mon Sep 17 00:00:00 2001 From: Nick Felt Date: Wed, 15 Jul 2020 16:05:24 -0700 Subject: [PATCH] Emit deprecation warning when using Beholder python API Sample message: ``` tensorboard/plugins/beholder/beholder_demo.py:215: UserWarning: ====================================================================== Beholder is deprecated and will be removed in a future TensorBoard release. See https://github.com/tensorflow/tensorboard/issues/3843 ====================================================================== beholder = beholder_lib.Beholder(logdir=LOG_DIRECTORY) ``` --- tensorboard/plugins/beholder/beholder.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tensorboard/plugins/beholder/beholder.py b/tensorboard/plugins/beholder/beholder.py index 30f445f4d76..e4e0e0fd8c6 100644 --- a/tensorboard/plugins/beholder/beholder.py +++ b/tensorboard/plugins/beholder/beholder.py @@ -18,6 +18,7 @@ import os import time +import warnings import numpy as np import tensorflow as tf @@ -44,8 +45,20 @@ logger = tb_logging.get_logger() +def _log_deprecation_warning(): + separator = "=" * 70 + lines = [ + separator, + "Beholder is deprecated and will be removed in a future TensorBoard", + "release. See https://github.com/tensorflow/tensorboard/issues/3843", + separator, + ] + warnings.warn("\n" + "\n".join(lines), stacklevel=3) + + class Beholder(object): def __init__(self, logdir): + _log_deprecation_warning() self.PLUGIN_LOGDIR = logdir + "/plugins/" + PLUGIN_NAME self.is_recording = False @@ -226,6 +239,7 @@ def __init__(self, logdir): Args: logdir: Directory where Beholder should write data. """ + _log_deprecation_warning() self._logdir = logdir self.beholder = None