Skip to content

Commit 48665fe

Browse files
authored
frontend: reinstate registration for conditional plugins (#2340)
Summary: Plugins whose backends are provided via “loaders” rather than the plugins themselves may fail to load. We still want to allow those plugins to display a message in the frontend indicating what must be done to enable them (e.g., update TensorFlow, start a `tfdbg` debugger), which requires registering their frontends unconditionally. This is a short-term hack to retain functionality prior to #2304 (with the minor change that these plugins will now always appear at the end of the list). We’ll want to replace this with a better mechanism when time permits. Fixes #2338. Test Plan: Launch TensorBoard without TensorFlow installed and with no flags other than `--logdir`. Note that the beholder, debugger, hparams, what-if tool, and profile dashboards all have valid entries in the “inactive” dropdown, displaying appropriate help messages. Verify that of the plugins listed in `default.py`, all those provided via loaders now have `registerDashboard` statements. wchargin-branch: register-conditional-plugins
1 parent b764306 commit 48665fe

File tree

11 files changed

+55
-0
lines changed

11 files changed

+55
-0
lines changed

tensorboard/plugins/beholder/beholder_plugin.py

+2
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ def is_active(self):
7575
tf.io.gfile.exists(info_filename)
7676

7777
def frontend_metadata(self):
78+
# TODO(#2338): Keep this in sync with the `registerDashboard` call
79+
# on the frontend until that call is removed.
7880
return super(BeholderPlugin, self).frontend_metadata()._replace(
7981
element_name='tf-beholder-dashboard',
8082
remove_dom=True,

tensorboard/plugins/beholder/tf_beholder_dashboard/tf-beholder-dashboard.html

+8
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,14 @@ <h3>No Beholder data was found.</h3>
513513
},
514514
});
515515

516+
// TODO(#2338): Remove this, and set up the "no TF" message properly.
517+
// Keep this in sync with `frontend_metadata` in `beholder_plugin.py`.
518+
tf_tensorboard.registerDashboard({
519+
plugin: PLUGIN_NAME,
520+
elementName: 'tf-beholder-dashboard',
521+
shouldRemoveDom: true,
522+
});
523+
516524
})();
517525
</script>
518526
</dom-module>

tensorboard/plugins/debugger/debugger_plugin.py

+2
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ def is_active(self):
152152
constants.DEBUGGER_PLUGIN_NAME))
153153

154154
def frontend_metadata(self):
155+
# TODO(#2338): Keep this in sync with the `registerDashboard` call
156+
# on the frontend until that call is removed.
155157
return super(DebuggerPlugin, self).frontend_metadata()._replace(
156158
element_name='tf-debugger-dashboard',
157159
)

tensorboard/plugins/debugger/interactive_debugger_plugin.py

+2
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ def is_active(self):
160160
return self._grpc_port is not None
161161

162162
def frontend_metadata(self):
163+
# TODO(#2338): Keep this in sync with the `registerDashboard` call
164+
# on the frontend until that call is removed.
163165
return super(InteractiveDebuggerPlugin, self).frontend_metadata()._replace(
164166
element_name='tf-debugger-dashboard',
165167
)

tensorboard/plugins/debugger/tf_debugger_dashboard/tf-debugger-dashboard.html

+8
Original file line numberDiff line numberDiff line change
@@ -1426,5 +1426,13 @@
14261426
{defaultValue: _DEFAULT_TOP_RIGHT_QUADRANT_HEIGHT}),
14271427
});
14281428

1429+
// TODO(#2338): Remove this, and set up the "no debugger enabled"
1430+
// message properly. Keep this in sync with `frontend_metadata` in
1431+
// both `debugger_plugin.py` and `interactive_debugger_plugin.py`.
1432+
tf_tensorboard.registerDashboard({
1433+
plugin: 'debugger',
1434+
elementName: 'tf-debugger-dashboard',
1435+
});
1436+
14291437
</script>
14301438
</dom-module>

tensorboard/plugins/hparams/hparams_plugin.py

+2
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ def is_active(self):
8484
metadata.PLUGIN_NAME))
8585

8686
def frontend_metadata(self):
87+
# TODO(#2338): Keep this in sync with the `registerDashboard` call
88+
# on the frontend until that call is removed.
8789
return super(HParamsPlugin, self).frontend_metadata()._replace(
8890
element_name='tf-hparams-dashboard',
8991
)

tensorboard/plugins/hparams/tf_hparams_dashboard/tf-hparams-dashboard.html

+8
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,14 @@
8383
}
8484
});
8585

86+
// TODO(#2338): Remove this, and set up a "no TF" message properly.
87+
// Keep this in sync with `frontend_metadata` in
88+
// `hparams_plugin.py`.
89+
tf_tensorboard.registerDashboard({
90+
plugin: PLUGIN_NAME,
91+
elementName: 'tf-hparams-dashboard'
92+
});
93+
8694
})();
8795
</script>
8896
</dom-module>

tensorboard/plugins/interactive_inference/interactive_inference_plugin.py

+2
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ def is_active(self):
109109
return False
110110

111111
def frontend_metadata(self):
112+
# TODO(#2338): Keep this in sync with the `registerDashboard` call
113+
# on the frontend until that call is removed.
112114
return super(InteractiveInferencePlugin, self).frontend_metadata()._replace(
113115
element_name='tf-interactive-inference-dashboard',
114116
tab_name='What-If Tool',

tensorboard/plugins/interactive_inference/tf_interactive_inference_dashboard/tf-interactive-inference-dashboard.html

+9
Original file line numberDiff line numberDiff line change
@@ -5819,6 +5819,15 @@ <h2>Show similarity to selected datapoint</h2>
58195819
},
58205820
});
58215821

5822+
// TODO(#2338): Remove this, and set up a "no TF" message properly.
5823+
// Keep this in sync with `frontend_metadata` in
5824+
// `interactive_inference_plugin.py`.
5825+
tf_tensorboard.registerDashboard({
5826+
plugin: PLUGIN_NAME,
5827+
elementName: 'tf-interactive-inference-dashboard',
5828+
tabName: 'What-If Tool',
5829+
});
5830+
58225831
})();
58235832
</script>
58245833
</dom-module>

tensorboard/plugins/profile/profile_plugin.py

+2
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ def compute_is_active():
136136
return self._is_active
137137

138138
def frontend_metadata(self):
139+
# TODO(#2338): Keep this in sync with the `registerDashboard` call
140+
# on the frontend until that call is removed.
139141
return super(ProfilePlugin, self).frontend_metadata()._replace(
140142
element_name='tf-profile-dashboard',
141143
disable_reload=True,

tensorboard/plugins/profile/tf_profile_dashboard/tf-profile-dashboard.html

+10
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,8 @@ <h3>No profile data was found.</h3>
496496
this.set('_isAttached', true);
497497
// Check if the plugin was created
498498
this._requestManager
499+
// TODO(#2338): The plugins listing is probably not the right
500+
// source of truth.
499501
.request(tf_backend.getRouter().pluginsListing())
500502
.then(plugins => {
501503
if (!(PLUGIN_NAME in plugins)) {
@@ -774,6 +776,14 @@ <h3>No profile data was found.</h3>
774776
},
775777
});
776778

779+
// TODO(#2338): Remove this, and set up the "no TF" message properly.
780+
// Keep this in sync with `frontend_metadata` in `profile_plugin.py`.
781+
tf_tensorboard.registerDashboard({
782+
plugin: PLUGIN_NAME,
783+
elementName: 'tf-profile-dashboard',
784+
isReloadDisabled: true,
785+
});
786+
777787
})();
778788
</script>
779789
</dom-module>

0 commit comments

Comments
 (0)