Skip to content

Commit dd1a411

Browse files
committed
Revert "Add --plugins option to uploader (#3377)"
This reverts commit 343456b. Test Plan: Running `bazel run //tensorboard -- dev list` now works. Previously, it failed with: ``` File ".../tensorboard/uploader/uploader_main.py", line 750, in _get_server_info server_info = server_info_lib.fetch_server_info(origin, flags.plugins) AttributeError: 'Namespace' object has no attribute 'plugins' ``` wchargin-branch: revert-uploader-plugins-flag
1 parent e94fabf commit dd1a411

File tree

4 files changed

+27
-102
lines changed

4 files changed

+27
-102
lines changed

tensorboard/uploader/proto/server_info.proto

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,31 @@ package tensorboard.service;
88
message ServerInfoRequest {
99
// Client-side TensorBoard version, per `tensorboard.version.VERSION`.
1010
string version = 1;
11-
// Information about the plugins for which the client wishes to upload data.
12-
//
13-
// If specified then the list of plugins will be confirmed by the server and
14-
// echoed in the PluginControl.allowed_plugins field. Otherwise the server
15-
// will return the default set of plugins it supports.
16-
//
17-
// If one of the plugins is not supported by the server then it will respond
18-
// with compatibility verdict VERDICT_ERROR.
19-
PluginSpecification plugin_specification = 2;
2011
}
2112

2213
message ServerInfoResponse {
23-
// Primary bottom-line: is the server compatible with the client, can it
24-
// serve its request, and is there anything that the end user should be
25-
// aware of?
14+
// Primary bottom-line: is the server compatible with the client, and is
15+
// there anything that the end user should be aware of?
2616
Compatibility compatibility = 1;
2717
// Identifier for a gRPC server providing the `TensorBoardExporterService` and
2818
// `TensorBoardWriterService` services (under the `tensorboard.service` proto
2919
// package).
3020
ApiServer api_server = 2;
3121
// How to generate URLs to experiment pages.
3222
ExperimentUrlFormat url_format = 3;
33-
// Information about the plugins for which data should be uploaded.
23+
// For which plugins should we upload data? (Even if the uploader is
24+
// structurally capable of uploading data from many plugins, we only actually
25+
// upload data that can be currently displayed in TensorBoard.dev. Otherwise,
26+
// users may be surprised to see that experiments that they uploaded a while
27+
// ago and have since shared or published now have extra information that
28+
// they didn't realize had been uploaded.)
3429
//
35-
// If PluginSpecification.requested_plugins is specified then
36-
// that list of plugins will be confirmed by the server and echoed in the
37-
// the response. Otherwise the server will return the default set of
38-
// plugins it supports.
30+
// The client may always choose to upload less data than is permitted by this
31+
// field: e.g., if the end user specifies not to upload data for a given
32+
// plugin, or the client does not yet support uploading some kind of data.
3933
//
40-
// The client should only upload data for the plugins in the response even
41-
// if it is capable of uploading more data.
34+
// If this field is omitted, there are no upfront restrictions on what the
35+
// client may send.
4236
PluginControl plugin_control = 4;
4337
}
4438

@@ -80,15 +74,8 @@ message ExperimentUrlFormat {
8074
string id_placeholder = 2;
8175
}
8276

83-
message PluginSpecification {
84-
// Plugins for which the client wishes to upload data. These are plugin names
85-
// as stored in the the `SummaryMetadata.plugin_data.plugin_name` proto
86-
// field.
87-
repeated string upload_plugins = 2;
88-
}
89-
9077
message PluginControl {
91-
// Plugins for which data should be uploaded. These are plugin names as
78+
// Only send data from plugins with these names. These are plugin names as
9279
// stored in the the `SummaryMetadata.plugin_data.plugin_name` proto field.
9380
repeated string allowed_plugins = 1;
9481
}

tensorboard/uploader/server_info.py

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
from google.protobuf import message
2222
import requests
2323

24-
from absl import logging
2524
from tensorboard import version
2625
from tensorboard.plugins.scalar import metadata as scalars_metadata
2726
from tensorboard.uploader.proto import server_info_pb2
@@ -31,31 +30,19 @@
3130
_REQUEST_TIMEOUT_SECONDS = 10
3231

3332

34-
def _server_info_request(upload_plugins):
35-
"""Generates a ServerInfoRequest
36-
37-
Args:
38-
upload_plugins: List of plugin names requested by the user and to be
39-
verified by the server.
40-
41-
Returns:
42-
A `server_info_pb2.ServerInfoRequest` message.
43-
"""
33+
def _server_info_request():
4434
request = server_info_pb2.ServerInfoRequest()
4535
request.version = version.VERSION
46-
request.plugin_specification.upload_plugins[:] = upload_plugins
4736
return request
4837

4938

50-
def fetch_server_info(origin, upload_plugins):
39+
def fetch_server_info(origin):
5140
"""Fetches server info from a remote server.
5241
5342
Args:
5443
origin: The server with which to communicate. Should be a string
5544
like "https://tensorboard.dev", including protocol, host, and (if
5645
needed) port.
57-
upload_plugins: List of plugins names requested by the user and to be
58-
verified by the server.
5946
6047
Returns:
6148
A `server_info_pb2.ServerInfoResponse` message.
@@ -65,9 +52,7 @@ def fetch_server_info(origin, upload_plugins):
6552
communicate with the remote server.
6653
"""
6754
endpoint = "%s/api/uploader" % origin
68-
server_info_request = _server_info_request(upload_plugins)
69-
post_body = server_info_request.SerializeToString()
70-
logging.info("Requested server info: <%r>", server_info_request)
55+
post_body = _server_info_request().SerializeToString()
7156
try:
7257
response = requests.post(
7358
endpoint,
@@ -90,15 +75,13 @@ def fetch_server_info(origin, upload_plugins):
9075
)
9176

9277

93-
def create_server_info(frontend_origin, api_endpoint, upload_plugins):
78+
def create_server_info(frontend_origin, api_endpoint):
9479
"""Manually creates server info given a frontend and backend.
9580
9681
Args:
9782
frontend_origin: The origin of the TensorBoard.dev frontend, like
9883
"https://tensorboard.dev" or "http://localhost:8000".
9984
api_endpoint: As to `server_info_pb2.ApiServer.endpoint`.
100-
upload_plugins: List of plugin names requested by the user and to be
101-
verified by the server.
10285
10386
Returns:
10487
A `server_info_pb2.ServerInfoResponse` message.
@@ -112,7 +95,6 @@ def create_server_info(frontend_origin, api_endpoint, upload_plugins):
11295
placeholder = "{%s}" % placeholder
11396
url_format.template = "%s/experiment/%s/" % (frontend_origin, placeholder)
11497
url_format.id_placeholder = placeholder
115-
result.plugin_control.allowed_plugins[:] = upload_plugins
11698
return result
11799

118100

tensorboard/uploader/server_info_test.py

Lines changed: 7 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -70,39 +70,20 @@ def app(request):
7070
body = request.get_data()
7171
request_pb = server_info_pb2.ServerInfoRequest.FromString(body)
7272
self.assertEqual(request_pb.version, version.VERSION)
73-
self.assertEqual(request_pb.plugin_specification.upload_plugins, [])
7473
return wrappers.BaseResponse(expected_result.SerializeToString())
7574

7675
origin = self._start_server(app)
77-
result = server_info.fetch_server_info(origin, [])
76+
result = server_info.fetch_server_info(origin)
7877
self.assertEqual(result, expected_result)
7978

80-
def test_fetches_with_plugins(self):
81-
@wrappers.BaseRequest.application
82-
def app(request):
83-
body = request.get_data()
84-
request_pb = server_info_pb2.ServerInfoRequest.FromString(body)
85-
self.assertEqual(request_pb.version, version.VERSION)
86-
self.assertEqual(
87-
request_pb.plugin_specification.upload_plugins,
88-
["plugin1", "plugin2"],
89-
)
90-
return wrappers.BaseResponse(
91-
server_info_pb2.ServerInfoResponse().SerializeToString()
92-
)
93-
94-
origin = self._start_server(app)
95-
result = server_info.fetch_server_info(origin, ["plugin1", "plugin2"])
96-
self.assertIsNotNone(result)
97-
9879
def test_econnrefused(self):
9980
(family, localhost) = _localhost()
10081
s = socket.socket(family)
10182
s.bind((localhost, 0))
10283
self.addCleanup(s.close)
10384
port = s.getsockname()[1]
10485
with self.assertRaises(server_info.CommunicationError) as cm:
105-
server_info.fetch_server_info("http://localhost:%d" % port, [])
86+
server_info.fetch_server_info("http://localhost:%d" % port)
10687
msg = str(cm.exception)
10788
self.assertIn("Failed to connect to backend", msg)
10889
if os.name != "nt":
@@ -116,7 +97,7 @@ def app(request):
11697

11798
origin = self._start_server(app)
11899
with self.assertRaises(server_info.CommunicationError) as cm:
119-
server_info.fetch_server_info(origin, [])
100+
server_info.fetch_server_info(origin)
120101
msg = str(cm.exception)
121102
self.assertIn("Non-OK status from backend (502 Bad Gateway)", msg)
122103
self.assertIn("very sad", msg)
@@ -129,7 +110,7 @@ def app(request):
129110

130111
origin = self._start_server(app)
131112
with self.assertRaises(server_info.CommunicationError) as cm:
132-
server_info.fetch_server_info(origin, [])
113+
server_info.fetch_server_info(origin)
133114
msg = str(cm.exception)
134115
self.assertIn("Corrupt response from backend", msg)
135116
self.assertIn("an unlikely proto", msg)
@@ -142,18 +123,18 @@ def app(request):
142123
return wrappers.BaseResponse(result.SerializeToString())
143124

144125
origin = self._start_server(app)
145-
result = server_info.fetch_server_info(origin, [])
126+
result = server_info.fetch_server_info(origin)
146127
expected_user_agent = "tensorboard/%s" % version.VERSION
147128
self.assertEqual(result.compatibility.details, expected_user_agent)
148129

149130

150131
class CreateServerInfoTest(tb_test.TestCase):
151132
"""Tests for `create_server_info`."""
152133

153-
def test_response(self):
134+
def test(self):
154135
frontend = "http://localhost:8080"
155136
backend = "localhost:10000"
156-
result = server_info.create_server_info(frontend, backend, [])
137+
result = server_info.create_server_info(frontend, backend)
157138

158139
expected_compatibility = server_info_pb2.Compatibility()
159140
expected_compatibility.verdict = server_info_pb2.VERDICT_OK
@@ -171,19 +152,6 @@ def test_response(self):
171152
expected_url = "http://localhost:8080/experiment/123/"
172153
self.assertEqual(actual_url, expected_url)
173154

174-
self.assertEqual(result.plugin_control.allowed_plugins, [])
175-
176-
def test_response_with_plugins(self):
177-
frontend = "http://localhost:8080"
178-
backend = "localhost:10000"
179-
result = server_info.create_server_info(
180-
frontend, backend, ["plugin1", "plugin2"]
181-
)
182-
183-
self.assertEqual(
184-
result.plugin_control.allowed_plugins, ["plugin1", "plugin2"]
185-
)
186-
187155

188156
class ExperimentUrlTest(tb_test.TestCase):
189157
"""Tests for `experiment_url`."""

tensorboard/uploader/uploader_main.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -159,16 +159,6 @@ def _define_flags(parser):
159159
help="Experiment description. Markdown format. Max 600 characters.",
160160
)
161161

162-
upload.add_argument(
163-
"--plugins",
164-
type=str,
165-
nargs="*",
166-
default=[],
167-
help="List of plugins for which data should be uploaded. If "
168-
"unspecified then data will be uploaded for all plugins supported by "
169-
"the server.",
170-
)
171-
172162
update_metadata = subparsers.add_parser(
173163
"update-metadata",
174164
help="change the name, description, or other user "
@@ -744,10 +734,8 @@ def _get_intent(flags):
744734
def _get_server_info(flags):
745735
origin = flags.origin or _DEFAULT_ORIGIN
746736
if flags.api_endpoint and not flags.origin:
747-
return server_info_lib.create_server_info(
748-
origin, flags.api_endpoint, flags.plugins
749-
)
750-
server_info = server_info_lib.fetch_server_info(origin, flags.plugins)
737+
return server_info_lib.create_server_info(origin, flags.api_endpoint)
738+
server_info = server_info_lib.fetch_server_info(origin)
751739
# Override with any API server explicitly specified on the command
752740
# line, but only if the server accepted our initial handshake.
753741
if flags.api_endpoint and server_info.api_server.endpoint:

0 commit comments

Comments
 (0)