Skip to content

Commit bbc9e4f

Browse files
authored
projector: Fix standalone vz_projector server. (#6069)
See: #6065 We document the ability to run the projector plugin in standalone mode: https://github.com/tensorflow/tensorboard/blob/master/tensorboard/plugins/projector/README.md But it doesn't work. The first thing to fix is to get the ":standalone" target to be executable and bring up a working server: * Hard to know exactly where things went wrong. I have found evidence that this worked as late as [September 2020](#4158). I suspect things went wrong in [April 2021](https://github.com/tensorflow/tensorboard/pull/4906/files), when tensorboard_html_binary() was replaced by tb_combine_html(). * In the case of vz_projector it seems we can just delete the current ":standalone" target and rename the ":standalone_lib" target to ":standalone". tb_combine_html() doesn't seem to be necessary for any part of the build. tf_web_library() produces an executable web server (Amazing! Who knew?). The second thing to fix is to get it to render a working page. * As is, the page would wail with the error message "Cannot read properties of null (reading 'appendChild')". In this case, the null property is `document.body`. * Again, not really sure where things went wrong but this is probably also related to the changes in April 2021. * The fix here is to load the js binary in the `body` tag (much like we do for `//tensorboard` target). The third thing to fix is to get a constant port of "6006". * As is, the web server would start up with random ports. * The relevant change here is #3047, where port is set to '0'. But the reason for that change is no longer relevant - the test infrastructure the change was supporting has all been deleted. * The fix is to change the port for the web server back to '6006'.
1 parent 503de04 commit bbc9e4f

File tree

4 files changed

+7
-17
lines changed

4 files changed

+7
-17
lines changed

tensorboard/defs/web.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def _tf_web_library(ctx):
9999
)
100100
params = struct(
101101
label=str(ctx.label),
102-
bind="localhost:0",
102+
bind="localhost:6006",
103103
manifest=[long_path(ctx, man) for man in devserver_manifests.to_list()],
104104
external_asset=[struct(webpath=k, path=v)
105105
for k, v in ctx.attr.external_assets.items()])

tensorboard/plugins/projector/tf_projector_plugin/BUILD

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ tb_combine_html(
2222
output_path = "/tf-projector/projector_binary.html",
2323
deps = [
2424
":tf_projector_plugin",
25-
"//tensorboard/plugins/projector/vz_projector:standalone_lib",
25+
"//tensorboard/plugins/projector/vz_projector:standalone",
2626
],
2727
)
2828

@@ -34,6 +34,6 @@ tf_web_library(
3434
path = "/tf-projector",
3535
deps = [
3636
"//tensorboard/components/tf_imports:roboto",
37-
"//tensorboard/plugins/projector/vz_projector:standalone_lib",
37+
"//tensorboard/plugins/projector/vz_projector:standalone",
3838
],
3939
)

tensorboard/plugins/projector/vz_projector/BUILD

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
load("//tensorboard/defs:defs.bzl", "tf_js_binary", "tf_ng_web_test_suite", "tf_ts_library")
2-
load("//tensorboard/defs:web.bzl", "tb_combine_html", "tf_web_library")
2+
load("//tensorboard/defs:web.bzl", "tf_web_library")
33

44
package(default_visibility = ["//tensorboard/plugins/projector:__subpackages__"])
55

@@ -112,9 +112,9 @@ genrule(
112112
)
113113

114114
tf_web_library(
115-
name = "standalone_lib",
115+
name = "standalone",
116116
srcs = [
117-
"standalone_lib.html",
117+
"standalone.html",
118118
"standalone_projector_config.json",
119119
":standalone_bundle.js",
120120
],
@@ -124,16 +124,6 @@ tf_web_library(
124124
],
125125
)
126126

127-
tb_combine_html(
128-
name = "standalone",
129-
input_path = "/standalone_lib.html",
130-
js_path = "/standalone.js",
131-
output_path = "/standalone.html",
132-
deps = [
133-
":standalone_lib",
134-
],
135-
)
136-
137127
################# Test ##################
138128

139129
tf_ts_library(

tensorboard/plugins/projector/vz_projector/standalone_lib.html renamed to tensorboard/plugins/projector/vz_projector/standalone.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131

3232
<link rel="import" href="../tf-imports/roboto.html" />
3333

34-
<script jscomp-ignore src="standalone_bundle.js"></script>
3534
<script>
3635
(function (i, s, o, g, r, a, m) {
3736
i['GoogleAnalyticsObject'] = r;
@@ -72,6 +71,7 @@
7271
</style>
7372
</head>
7473
<body>
74+
<script jscomp-ignore src="standalone_bundle.js"></script>
7575
<vz-projector-app
7676
documentation-link="https://www.tensorflow.org/get_started/embedding_viz"
7777
bug-report-link="https://github.com/tensorflow/tensorboard/issues"

0 commit comments

Comments
 (0)