Skip to content

Commit a69d76c

Browse files
authored
histograms: omit empty runs from /tags route (#2989)
Summary: Analogous to 2fe5301, but for histograms and distributions. Test Plan: Tests updated. Manually confirmed that runs like `text_demo` continue to appear in the run selectors for the histogram and distributions dashboards even though they have no relevant data. wchargin-branch: histograms-omit-empty
1 parent 9cb8ab5 commit a69d76c

File tree

5 files changed

+5
-7
lines changed

5 files changed

+5
-7
lines changed

tensorboard/plugins/distribution/distributions_plugin_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def test_index(self):
108108
self._RUN_WITH_LEGACY_DISTRIBUTION,
109109
self._RUN_WITH_DISTRIBUTION])
110110
self.assertEqual({
111-
self._RUN_WITH_SCALARS: {},
111+
# _RUN_WITH_SCALARS omitted: No distribution data.
112112
self._RUN_WITH_LEGACY_DISTRIBUTION: {
113113
self._LEGACY_DISTRIBUTION_TAG: {
114114
'displayName': self._LEGACY_DISTRIBUTION_TAG,

tensorboard/plugins/distribution/http_api.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ Here is an example:
3131
}
3232
}
3333

34-
Note that runs without any histogram tags are included as keys with
35-
value the empty dictionary.
34+
Runs without any histogram tags are omitted from the result.
3635

3736
## `/data/plugin/distributions/distributions?run=foo&tag=bar`
3837

tensorboard/plugins/histogram/histograms_plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def index_impl(self):
112112
return result
113113

114114
runs = self._multiplexer.Runs()
115-
result = {run: {} for run in runs}
115+
result = collections.defaultdict(lambda: {})
116116

117117
mapping = self._multiplexer.PluginRunToTagToContent(metadata.PLUGIN_NAME)
118118
for (run, tag_to_content) in six.iteritems(mapping):

tensorboard/plugins/histogram/histograms_plugin_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def test_index(self):
107107
self._RUN_WITH_LEGACY_HISTOGRAM,
108108
self._RUN_WITH_HISTOGRAM])
109109
self.assertEqual({
110-
self._RUN_WITH_SCALARS: {},
110+
# _RUN_WITH_SCALARS omitted: No histogram data.
111111
self._RUN_WITH_LEGACY_HISTOGRAM: {
112112
self._LEGACY_HISTOGRAM_TAG: {
113113
'displayName': self._LEGACY_HISTOGRAM_TAG,

tensorboard/plugins/histogram/http_api.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ Here is an example:
3030
}
3131
}
3232

33-
Note that runs without any histogram tags are included as keys with
34-
value the empty dictionary.
33+
Runs without any histogram tags are omitted from the result.
3534

3635
## `/data/plugin/histograms/histograms?run=foo&tag=bar`
3736

0 commit comments

Comments
 (0)