Skip to content

Commit

Permalink
Emit deprecation warning when using Beholder python API
Browse files Browse the repository at this point in the history
Sample message:

```
tensorboard/plugins/beholder/beholder_demo.py:215: UserWarning:
======================================================================
Beholder is deprecated and will be removed in a future TensorBoard
release. See tensorflow#3843
======================================================================
  beholder = beholder_lib.Beholder(logdir=LOG_DIRECTORY)
```
  • Loading branch information
nfelt committed Jul 15, 2020
1 parent d384dde commit d0522a6
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tensorboard/plugins/beholder/beholder.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import os
import time
import warnings

import numpy as np
import tensorflow as tf
Expand All @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit d0522a6

Please sign in to comment.