Skip to content
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
5 changes: 3 additions & 2 deletions docs/debugger_v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,9 @@ tensorboard --logdir /tmp/tfdbg2_logdir
```

In the web browser, navigate to TensorBoard’s page at http://localhost:6006. The
“Debugger V2” plugin should be activated by default, displaying a page that
looks like the following:
“Debugger V2” plugin will be inactive by default, so select it from the
“Inactive plugins” menu at top right. Once selected, it should look like the
following:

![Debugger V2 full view screenshot](./images/debugger_v2_1_full_view.png)

Expand Down
36 changes: 21 additions & 15 deletions tensorboard/plugins/debugger_v2/debugger_v2_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
"""The TensorBoard Debugger V2 plugin."""


import threading

from werkzeug import wrappers

from tensorboard import errors
Expand Down Expand Up @@ -50,11 +52,23 @@ def __init__(self, context):
"""
super(DebuggerV2Plugin, self).__init__(context)
self._logdir = context.logdir
# TODO(cais): Implement factory for DataProvider that takes into account
# the settings.
self._data_provider = debug_data_provider.LocalDebuggerV2DataProvider(
self._logdir
)
self._underlying_data_provider = None
# Held while initializing `_underlying_data_provider` for the first
# time, to make sure that we only construct one.
self._data_provider_init_lock = threading.Lock()

@property
def _data_provider(self):
if self._underlying_data_provider is not None:
return self._underlying_data_provider
with self._data_provider_init_lock:
if self._underlying_data_provider is not None:
return self._underlying_data_provider
# TODO(cais): Implement factory for DataProvider that takes into account
# the settings.
dp = debug_data_provider.LocalDebuggerV2DataProvider(self._logdir)
self._underlying_data_provider = dp
return dp

def get_plugin_apps(self):
# TODO(cais): Add routes as they are implemented.
Expand All @@ -73,16 +87,8 @@ def get_plugin_apps(self):
}

def is_active(self):
"""Check whether the Debugger V2 Plugin is always active.

When no data in the tfdbg v2 format is available, a custom information
screen is displayed to instruct the user on how to generate such data
to be able to use the plugin.

Returns:
`True` if and only if data in tfdbg v2's DebugEvent format is available.
"""
return bool(self._data_provider.list_runs(experiment_id=""))
"""The Debugger V2 plugin must be manually selected."""
return False

def frontend_metadata(self):
return base_plugin.FrontendMetadata(
Expand Down
16 changes: 1 addition & 15 deletions tensorboard/plugins/debugger_v2/debugger_v2_plugin_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def testPluginIsNotActiveByDefault(self):

def testPluginIsActiveWithDataExists(self):
_generate_tfdbg_v2_data(self.logdir)
self.assertTrue(self.plugin.is_active())
self.assertFalse(self.plugin.is_active()) # never explicitly active

def testConcurrentCallsToPluginIsActiveWhenNotActive(self):
results = collections.deque()
Expand All @@ -165,20 +165,6 @@ def query_is_active():
thread.join()
self.assertEqual(list(results), [False] * 4)

def testConcurrentCallsToPluginIsActiveWhenActive(self):
_generate_tfdbg_v2_data(self.logdir)
results = collections.deque()

def query_is_active():
results.append(self.plugin.is_active())

threads = [threading.Thread(target=query_is_active) for _ in range(4)]
for thread in threads:
thread.start()
for thread in threads:
thread.join()
self.assertEqual(list(results), [True] * 4)

def testServeRunsWithoutExistingRuns(self):
response = self.server.get(_ROUTE_PREFIX + "/runs")
self.assertEqual(200, response.status_code)
Expand Down