From a76a807b02360e6a4f6a76d3235e992d869ef1e7 Mon Sep 17 00:00:00 2001 From: David Soergel Date: Thu, 5 Dec 2019 10:51:54 -0500 Subject: [PATCH 1/2] Fix graph plugin with data provider, and its test --- tensorboard/plugins/graph/graphs_plugin.py | 2 +- .../plugins/graph/graphs_plugin_test.py | 21 ++++++++++++------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/tensorboard/plugins/graph/graphs_plugin.py b/tensorboard/plugins/graph/graphs_plugin.py index eb77488aa6..131cf59745 100644 --- a/tensorboard/plugins/graph/graphs_plugin.py +++ b/tensorboard/plugins/graph/graphs_plugin.py @@ -116,7 +116,7 @@ def add_row_item(run, tag=None): for (run_name, tag_to_time_series) in six.iteritems(mapping): for tag in tag_to_time_series: (run_item, tag_item) = add_row_item(run_name, tag) - run_item['op_graph'] = True + run_item['run_graph'] = True if tag_item: tag_item['op_graph'] = True return result diff --git a/tensorboard/plugins/graph/graphs_plugin_test.py b/tensorboard/plugins/graph/graphs_plugin_test.py index 90becd6d00..656c701cef 100644 --- a/tensorboard/plugins/graph/graphs_plugin_test.py +++ b/tensorboard/plugins/graph/graphs_plugin_test.py @@ -173,12 +173,8 @@ def test_info(self, plugin): 'run': '_RUN_WITH_GRAPH_WITHOUT_METADATA', 'run_graph': True, 'tags': {}, - } - } - - if not plugin._data_provider: - # Hack, for now. - expected['_RUN_WITHOUT_GRAPH_WITH_METADATA'] = { + }, + '_RUN_WITHOUT_GRAPH_WITH_METADATA': { 'run': '_RUN_WITHOUT_GRAPH_WITH_METADATA', 'run_graph': False, 'tags': { @@ -189,9 +185,18 @@ def test_info(self, plugin): 'op_graph': False, }, }, - } + }, + } + + if plugin._data_provider: + # Hack, for now. + # Data providers don't yet pass RunMetadata, so this entry excludes it. + expected['_RUN_WITH_GRAPH_WITH_METADATA']['tags'] = {} + # Data providers don't yet pass RunMetadata, so this entry is completely omitted. + del expected['_RUN_WITHOUT_GRAPH_WITH_METADATA'] - self.assertItemsEqual(expected, plugin.info_impl('eid')) + actual = plugin.info_impl('eid') + self.assertEqual(expected, actual) @with_runs([_RUN_WITH_GRAPH_WITH_METADATA]) def test_graph_simple(self, plugin): From 5a944ce45fd1240ec8ebda1ae261bdf641f496f2 Mon Sep 17 00:00:00 2001 From: David Soergel Date: Thu, 5 Dec 2019 11:42:13 -0500 Subject: [PATCH 2/2] Don't filter on empty string tag when tag=None --- tensorboard/plugins/graph/graphs_plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorboard/plugins/graph/graphs_plugin.py b/tensorboard/plugins/graph/graphs_plugin.py index 131cf59745..8273969d63 100644 --- a/tensorboard/plugins/graph/graphs_plugin.py +++ b/tensorboard/plugins/graph/graphs_plugin.py @@ -249,7 +249,7 @@ def graph_route(self, request): """Given a single run, return the graph definition in protobuf format.""" experiment = plugin_util.experiment_id(request.environ) run = request.args.get('run') - tag = request.args.get('tag', '') + tag = request.args.get('tag') conceptual_arg = request.args.get('conceptual', False) is_conceptual = True if conceptual_arg == 'true' else False