Import tensorflow

This commit is contained in:
derek committed 2026-02-15 21:45:42 -08:00
1 parent f3e8b90764
commit c530630153
20524 files changed
+9017694 -25

No files matched your search

@@ -0,0 +1,365 @@
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""A data provider that talks to a gRPC server."""
import collections
import contextlib
import grpc
from tensorboard.util import tensor_util
from tensorboard.util import timing
from tensorboard import errors
from tensorboard.data import provider
from tensorboard.data.proto import data_provider_pb2
from tensorboard.data.proto import data_provider_pb2_grpc
def make_stub(channel):
"""Wraps a gRPC channel with a service stub."""
return data_provider_pb2_grpc.TensorBoardDataProviderStub(channel)
class GrpcDataProvider(provider.DataProvider):
"""Data provider that talks over gRPC."""
def __init__(self, addr, stub):
"""Initializes a GrpcDataProvider.
Args:
addr: String address of the remote peer. Used cosmetically for
data location.
stub: `data_provider_pb2_grpc.TensorBoardDataProviderStub`
value. See `make_stub` to construct one from a channel.
"""
self._addr = addr
self._stub = stub
def __str__(self):
return "GrpcDataProvider(addr=%r)" % self._addr
def experiment_metadata(self, ctx, *, experiment_id):
req = data_provider_pb2.GetExperimentRequest()
req.experiment_id = experiment_id
with _translate_grpc_error():
res = self._stub.GetExperiment(req)
res = provider.ExperimentMetadata(
data_location=res.data_location,
experiment_name=res.name,
experiment_description=res.description,
creation_time=_timestamp_proto_to_float(res.creation_time),
)
return res
def list_plugins(self, ctx, *, experiment_id):
req = data_provider_pb2.ListPluginsRequest()
req.experiment_id = experiment_id
with _translate_grpc_error():
res = self._stub.ListPlugins(req)
return [p.name for p in res.plugins]
def list_runs(self, ctx, *, experiment_id):
req = data_provider_pb2.ListRunsRequest()
req.experiment_id = experiment_id
with _translate_grpc_error():
res = self._stub.ListRuns(req)
return [
provider.Run(
run_id=run.name,
run_name=run.name,
start_time=run.start_time,
)
for run in res.runs
]
@timing.log_latency
def list_scalars(
self, ctx, *, experiment_id, plugin_name, run_tag_filter=None
):
with timing.log_latency("build request"):
req = data_provider_pb2.ListScalarsRequest()
req.experiment_id = experiment_id
req.plugin_filter.plugin_name = plugin_name
_populate_rtf(run_tag_filter, req.run_tag_filter)
with timing.log_latency("_stub.ListScalars"):
with _translate_grpc_error():
res = self._stub.ListScalars(req)
with timing.log_latency("build result"):
result = {}
for run_entry in res.runs:
tags = {}
result[run_entry.run_name] = tags
for tag_entry in run_entry.tags:
time_series = tag_entry.metadata
tags[tag_entry.tag_name] = provider.ScalarTimeSeries(
max_step=time_series.max_step,
max_wall_time=time_series.max_wall_time,
plugin_content=time_series.summary_metadata.plugin_data.content,
description=time_series.summary_metadata.summary_description,
display_name=time_series.summary_metadata.display_name,
)
return result
@timing.log_latency
def read_scalars(
self,
ctx,
*,
experiment_id,
plugin_name,
downsample=None,
run_tag_filter=None,
):
with timing.log_latency("build request"):
req = data_provider_pb2.ReadScalarsRequest()
req.experiment_id = experiment_id
req.plugin_filter.plugin_name = plugin_name
_populate_rtf(run_tag_filter, req.run_tag_filter)
req.downsample.num_points = downsample
with timing.log_latency("_stub.ReadScalars"):
with _translate_grpc_error():
res = self._stub.ReadScalars(req)
with timing.log_latency("build result"):
result = {}
for run_entry in res.runs:
tags = {}
result[run_entry.run_name] = tags
for tag_entry in run_entry.tags:
series = []
tags[tag_entry.tag_name] = series
d = tag_entry.data
for step, wt, value in zip(d.step, d.wall_time, d.value):
point = provider.ScalarDatum(
step=step,
wall_time=wt,
value=value,
)
series.append(point)
return result
@timing.log_latency
def read_last_scalars(
self,
ctx,
*,
experiment_id,
plugin_name,
run_tag_filter=None,
):
with timing.log_latency("build request"):
req = data_provider_pb2.ReadScalarsRequest()
req.experiment_id = experiment_id
req.plugin_filter.plugin_name = plugin_name
_populate_rtf(run_tag_filter, req.run_tag_filter)
# `ReadScalars` always includes the most recent datum, therefore
# downsampling to one means fetching the latest value.
req.downsample.num_points = 1
with timing.log_latency("_stub.ReadScalars"):
with _translate_grpc_error():
res = self._stub.ReadScalars(req)
with timing.log_latency("build result"):
result = collections.defaultdict(dict)
for run_entry in res.runs:
run_name = run_entry.run_name
for tag_entry in run_entry.tags:
d = tag_entry.data
# There should be no more than one datum in
# `tag_entry.data` since downsample was set to 1.
for step, wt, value in zip(d.step, d.wall_time, d.value):
result[run_name][tag_entry.tag_name] = (
provider.ScalarDatum(
step=step,
wall_time=wt,
value=value,
)
)
return result
@timing.log_latency
def list_tensors(
self, ctx, *, experiment_id, plugin_name, run_tag_filter=None
):
with timing.log_latency("build request"):
req = data_provider_pb2.ListTensorsRequest()
req.experiment_id = experiment_id
req.plugin_filter.plugin_name = plugin_name
_populate_rtf(run_tag_filter, req.run_tag_filter)
with timing.log_latency("_stub.ListTensors"):
with _translate_grpc_error():
res = self._stub.ListTensors(req)
with timing.log_latency("build result"):
result = {}
for run_entry in res.runs:
tags = {}
result[run_entry.run_name] = tags
for tag_entry in run_entry.tags:
time_series = tag_entry.metadata
tags[tag_entry.tag_name] = provider.TensorTimeSeries(
max_step=time_series.max_step,
max_wall_time=time_series.max_wall_time,
plugin_content=time_series.summary_metadata.plugin_data.content,
description=time_series.summary_metadata.summary_description,
display_name=time_series.summary_metadata.display_name,
)
return result
@timing.log_latency
def read_tensors(
self,
ctx,
*,
experiment_id,
plugin_name,
downsample=None,
run_tag_filter=None,
):
with timing.log_latency("build request"):
req = data_provider_pb2.ReadTensorsRequest()
req.experiment_id = experiment_id
req.plugin_filter.plugin_name = plugin_name
_populate_rtf(run_tag_filter, req.run_tag_filter)
req.downsample.num_points = downsample
with timing.log_latency("_stub.ReadTensors"):
with _translate_grpc_error():
res = self._stub.ReadTensors(req)
with timing.log_latency("build result"):
result = {}
for run_entry in res.runs:
tags = {}
result[run_entry.run_name] = tags
for tag_entry in run_entry.tags:
series = []
tags[tag_entry.tag_name] = series
d = tag_entry.data
for step, wt, value in zip(d.step, d.wall_time, d.value):
point = provider.TensorDatum(
step=step,
wall_time=wt,
numpy=tensor_util.make_ndarray(value),
)
series.append(point)
return result
@timing.log_latency
def list_blob_sequences(
self, ctx, experiment_id, plugin_name, run_tag_filter=None
):
with timing.log_latency("build request"):
req = data_provider_pb2.ListBlobSequencesRequest()
req.experiment_id = experiment_id
req.plugin_filter.plugin_name = plugin_name
_populate_rtf(run_tag_filter, req.run_tag_filter)
with timing.log_latency("_stub.ListBlobSequences"):
with _translate_grpc_error():
res = self._stub.ListBlobSequences(req)
with timing.log_latency("build result"):
result = {}
for run_entry in res.runs:
tags = {}
result[run_entry.run_name] = tags
for tag_entry in run_entry.tags:
time_series = tag_entry.metadata
tags[tag_entry.tag_name] = provider.BlobSequenceTimeSeries(
max_step=time_series.max_step,
max_wall_time=time_series.max_wall_time,
max_length=time_series.max_length,
plugin_content=time_series.summary_metadata.plugin_data.content,
description=time_series.summary_metadata.summary_description,
display_name=time_series.summary_metadata.display_name,
)
return result
@timing.log_latency
def read_blob_sequences(
self,
ctx,
experiment_id,
plugin_name,
downsample=None,
run_tag_filter=None,
):
with timing.log_latency("build request"):
req = data_provider_pb2.ReadBlobSequencesRequest()
req.experiment_id = experiment_id
req.plugin_filter.plugin_name = plugin_name
_populate_rtf(run_tag_filter, req.run_tag_filter)
req.downsample.num_points = downsample
with timing.log_latency("_stub.ReadBlobSequences"):
with _translate_grpc_error():
res = self._stub.ReadBlobSequences(req)
with timing.log_latency("build result"):
result = {}
for run_entry in res.runs:
tags = {}
result[run_entry.run_name] = tags
for tag_entry in run_entry.tags:
series = []
tags[tag_entry.tag_name] = series
d = tag_entry.data
for step, wt, blob_sequence in zip(
d.step, d.wall_time, d.values
):
values = []
for ref in blob_sequence.blob_refs:
values.append(
provider.BlobReference(
blob_key=ref.blob_key, url=ref.url or None
)
)
point = provider.BlobSequenceDatum(
step=step, wall_time=wt, values=tuple(values)
)
series.append(point)
return result
@timing.log_latency
def read_blob(self, ctx, blob_key):
with timing.log_latency("build request"):
req = data_provider_pb2.ReadBlobRequest()
req.blob_key = blob_key
with timing.log_latency("list(_stub.ReadBlob)"):
with _translate_grpc_error():
responses = list(self._stub.ReadBlob(req))
with timing.log_latency("build result"):
return b"".join(res.data for res in responses)
@contextlib.contextmanager
def _translate_grpc_error():
try:
yield
except grpc.RpcError as e:
if e.code() == grpc.StatusCode.INVALID_ARGUMENT:
raise errors.InvalidArgumentError(e.details())
if e.code() == grpc.StatusCode.NOT_FOUND:
raise errors.NotFoundError(e.details())
if e.code() == grpc.StatusCode.PERMISSION_DENIED:
raise errors.PermissionDeniedError(e.details())
raise
def _populate_rtf(run_tag_filter, rtf_proto):
"""Copies `run_tag_filter` into `rtf_proto`."""
if run_tag_filter is None:
return
if run_tag_filter.runs is not None:
rtf_proto.runs.names[:] = sorted(run_tag_filter.runs)
if run_tag_filter.tags is not None:
rtf_proto.tags.names[:] = sorted(run_tag_filter.tags)
def _timestamp_proto_to_float(ts):
"""Converts `timestamp_pb2.Timestamp` to float seconds since epoch."""
return ts.ToNanoseconds() / 1e9
@@ -0,0 +1,46 @@
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Abstraction for data ingestion logic."""
import abc
class DataIngester(metaclass=abc.ABCMeta):
"""Link between a data source and a data provider.
A data ingester starts a reload operation in the background and
provides a data provider as a view.
"""
@property
@abc.abstractmethod
def data_provider(self):
"""Returns a `DataProvider`.
It may be an error to dereference this before `start` is called.
"""
pass
@abc.abstractmethod
def start(self):
"""Starts ingesting data.
This may start a background thread or process, and will return
once communication with that task is established. It won't block
forever as data is reloaded.
Must only be called once.
"""
pass
@@ -0,0 +1,517 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: tensorboard/data/proto/data_provider.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2
from tensorboard.compat.proto import summary_pb2 as tensorboard_dot_compat_dot_proto_dot_summary__pb2
try:
tensorboard_dot_compat_dot_proto_dot_histogram__pb2 = tensorboard_dot_compat_dot_proto_dot_summary__pb2.tensorboard_dot_compat_dot_proto_dot_histogram__pb2
except AttributeError:
tensorboard_dot_compat_dot_proto_dot_histogram__pb2 = tensorboard_dot_compat_dot_proto_dot_summary__pb2.tensorboard.compat.proto.histogram_pb2
from tensorboard.compat.proto import tensor_pb2 as tensorboard_dot_compat_dot_proto_dot_tensor__pb2
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n*tensorboard/data/proto/data_provider.proto\x12\x10tensorboard.data\x1a\x1fgoogle/protobuf/timestamp.proto\x1a&tensorboard/compat/proto/summary.proto\x1a%tensorboard/compat/proto/tensor.proto\"-\n\x14GetExperimentRequest\x12\x15\n\rexperiment_id\x18\x01 \x01(\t\"\x84\x01\n\x15GetExperimentResponse\x12\x15\n\rdata_location\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\t\x12\x31\n\rcreation_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"#\n\x0cPluginFilter\x12\x13\n\x0bplugin_name\x18\x01 \x01(\t\"d\n\x0cRunTagFilter\x12)\n\x04runs\x18\x01 \x01(\x0b\x32\x1b.tensorboard.data.RunFilter\x12)\n\x04tags\x18\x02 \x01(\x0b\x32\x1b.tensorboard.data.TagFilter\"\x1a\n\tRunFilter\x12\r\n\x05names\x18\x01 \x03(\t\"\x1a\n\tTagFilter\x12\r\n\x05names\x18\x01 \x03(\t\" \n\nDownsample\x12\x12\n\nnum_points\x18\x01 \x01(\x03\"+\n\x12ListPluginsRequest\x12\x15\n\rexperiment_id\x18\x01 \x01(\t\"@\n\x13ListPluginsResponse\x12)\n\x07plugins\x18\x01 \x03(\x0b\x32\x18.tensorboard.data.Plugin\"\x16\n\x06Plugin\x12\x0c\n\x04name\x18\x01 \x01(\t\"(\n\x0fListRunsRequest\x12\x15\n\rexperiment_id\x18\x01 \x01(\t\"7\n\x10ListRunsResponse\x12#\n\x04runs\x18\x01 \x03(\x0b\x32\x15.tensorboard.data.Run\"1\n\x03Run\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x12\n\nstart_time\x18\x03 \x01(\x01J\x04\x08\x01\x10\x02R\x02id\"\x9a\x01\n\x12ListScalarsRequest\x12\x15\n\rexperiment_id\x18\x01 \x01(\t\x12\x35\n\rplugin_filter\x18\x02 \x01(\x0b\x32\x1e.tensorboard.data.PluginFilter\x12\x36\n\x0erun_tag_filter\x18\x03 \x01(\x0b\x32\x1e.tensorboard.data.RunTagFilter\"\x81\x02\n\x13ListScalarsResponse\x12<\n\x04runs\x18\x01 \x03(\x0b\x32..tensorboard.data.ListScalarsResponse.RunEntry\x1aZ\n\x08RunEntry\x12\x10\n\x08run_name\x18\x01 \x01(\t\x12<\n\x04tags\x18\x02 \x03(\x0b\x32..tensorboard.data.ListScalarsResponse.TagEntry\x1aP\n\x08TagEntry\x12\x10\n\x08tag_name\x18\x01 \x01(\t\x12\x32\n\x08metadata\x18\x02 \x01(\x0b\x32 .tensorboard.data.ScalarMetadata\"q\n\x0eScalarMetadata\x12\x10\n\x08max_step\x18\x01 \x01(\x03\x12\x15\n\rmax_wall_time\x18\x02 \x01(\x01\x12\x36\n\x10summary_metadata\x18\x03 \x01(\x0b\x32\x1c.tensorboard.SummaryMetadata\"\xcc\x01\n\x12ReadScalarsRequest\x12\x15\n\rexperiment_id\x18\x01 \x01(\t\x12\x35\n\rplugin_filter\x18\x02 \x01(\x0b\x32\x1e.tensorboard.data.PluginFilter\x12\x36\n\x0erun_tag_filter\x18\x03 \x01(\x0b\x32\x1e.tensorboard.data.RunTagFilter\x12\x30\n\ndownsample\x18\x04 \x01(\x0b\x32\x1c.tensorboard.data.Downsample\"\xf9\x01\n\x13ReadScalarsResponse\x12<\n\x04runs\x18\x01 \x03(\x0b\x32..tensorboard.data.ReadScalarsResponse.RunEntry\x1aZ\n\x08RunEntry\x12\x10\n\x08run_name\x18\x01 \x01(\t\x12<\n\x04tags\x18\x02 \x03(\x0b\x32..tensorboard.data.ReadScalarsResponse.TagEntry\x1aH\n\x08TagEntry\x12\x10\n\x08tag_name\x18\x01 \x01(\t\x12*\n\x04\x64\x61ta\x18\x02 \x01(\x0b\x32\x1c.tensorboard.data.ScalarData\"<\n\nScalarData\x12\x0c\n\x04step\x18\x01 \x03(\x03\x12\x11\n\twall_time\x18\x02 \x03(\x01\x12\r\n\x05value\x18\x03 \x03(\x02\"\x9a\x01\n\x12ListTensorsRequest\x12\x15\n\rexperiment_id\x18\x01 \x01(\t\x12\x35\n\rplugin_filter\x18\x02 \x01(\x0b\x32\x1e.tensorboard.data.PluginFilter\x12\x36\n\x0erun_tag_filter\x18\x03 \x01(\x0b\x32\x1e.tensorboard.data.RunTagFilter\"\x81\x02\n\x13ListTensorsResponse\x12<\n\x04runs\x18\x01 \x03(\x0b\x32..tensorboard.data.ListTensorsResponse.RunEntry\x1aZ\n\x08RunEntry\x12\x10\n\x08run_name\x18\x01 \x01(\t\x12<\n\x04tags\x18\x02 \x03(\x0b\x32..tensorboard.data.ListTensorsResponse.TagEntry\x1aP\n\x08TagEntry\x12\x10\n\x08tag_name\x18\x01 \x01(\t\x12\x32\n\x08metadata\x18\x02 \x01(\x0b\x32 .tensorboard.data.TensorMetadata\"q\n\x0eTensorMetadata\x12\x10\n\x08max_step\x18\x01 \x01(\x03\x12\x15\n\rmax_wall_time\x18\x02 \x01(\x01\x12\x36\n\x10summary_metadata\x18\x03 \x01(\x0b\x32\x1c.tensorboard.SummaryMetadata\"\xcc\x01\n\x12ReadTensorsRequest\x12\x15\n\rexperiment_id\x18\x01 \x01(\t\x12\x35\n\rplugin_filter\x18\x02 \x01(\x0b\x32\x1e.tensorboard.data.PluginFilter\x12\x36\n\x0erun_tag_filter\x18\x03 \x01(\x0b\x32\x1e.tensorboard.data.RunTagFilter\x12\x30\n\ndownsample\x18\x04 \x01(\x0b\x32\x1c.tensorboard.data.Downsample\"\xf9\x01\n\x13ReadTensorsResponse\x12<\n\x04runs\x18\x01 \x03(\x0b\x32..tensorboard.data.ReadTensorsResponse.RunEntry\x1aZ\n\x08RunEntry\x12\x10\n\x08run_name\x18\x01 \x01(\t\x12<\n\x04tags\x18\x02 \x03(\x0b\x32..tensorboard.data.ReadTensorsResponse.TagEntry\x1aH\n\x08TagEntry\x12\x10\n\x08tag_name\x18\x01 \x01(\t\x12*\n\x04\x64\x61ta\x18\x02 \x01(\x0b\x32\x1c.tensorboard.data.TensorData\"V\n\nTensorData\x12\x0c\n\x04step\x18\x01 \x03(\x03\x12\x11\n\twall_time\x18\x02 \x03(\x01\x12\'\n\x05value\x18\x03 \x03(\x0b\x32\x18.tensorboard.TensorProto\"\xa0\x01\n\x18ListBlobSequencesRequest\x12\x15\n\rexperiment_id\x18\x01 \x01(\t\x12\x35\n\rplugin_filter\x18\x02 \x01(\x0b\x32\x1e.tensorboard.data.PluginFilter\x12\x36\n\x0erun_tag_filter\x18\x03 \x01(\x0b\x32\x1e.tensorboardLine truncated
_GETEXPERIMENTREQUEST = DESCRIPTOR.message_types_by_name['GetExperimentRequest']
_GETEXPERIMENTRESPONSE = DESCRIPTOR.message_types_by_name['GetExperimentResponse']
_PLUGINFILTER = DESCRIPTOR.message_types_by_name['PluginFilter']
_RUNTAGFILTER = DESCRIPTOR.message_types_by_name['RunTagFilter']
_RUNFILTER = DESCRIPTOR.message_types_by_name['RunFilter']
_TAGFILTER = DESCRIPTOR.message_types_by_name['TagFilter']
_DOWNSAMPLE = DESCRIPTOR.message_types_by_name['Downsample']
_LISTPLUGINSREQUEST = DESCRIPTOR.message_types_by_name['ListPluginsRequest']
_LISTPLUGINSRESPONSE = DESCRIPTOR.message_types_by_name['ListPluginsResponse']
_PLUGIN = DESCRIPTOR.message_types_by_name['Plugin']
_LISTRUNSREQUEST = DESCRIPTOR.message_types_by_name['ListRunsRequest']
_LISTRUNSRESPONSE = DESCRIPTOR.message_types_by_name['ListRunsResponse']
_RUN = DESCRIPTOR.message_types_by_name['Run']
_LISTSCALARSREQUEST = DESCRIPTOR.message_types_by_name['ListScalarsRequest']
_LISTSCALARSRESPONSE = DESCRIPTOR.message_types_by_name['ListScalarsResponse']
_LISTSCALARSRESPONSE_RUNENTRY = _LISTSCALARSRESPONSE.nested_types_by_name['RunEntry']
_LISTSCALARSRESPONSE_TAGENTRY = _LISTSCALARSRESPONSE.nested_types_by_name['TagEntry']
_SCALARMETADATA = DESCRIPTOR.message_types_by_name['ScalarMetadata']
_READSCALARSREQUEST = DESCRIPTOR.message_types_by_name['ReadScalarsRequest']
_READSCALARSRESPONSE = DESCRIPTOR.message_types_by_name['ReadScalarsResponse']
_READSCALARSRESPONSE_RUNENTRY = _READSCALARSRESPONSE.nested_types_by_name['RunEntry']
_READSCALARSRESPONSE_TAGENTRY = _READSCALARSRESPONSE.nested_types_by_name['TagEntry']
_SCALARDATA = DESCRIPTOR.message_types_by_name['ScalarData']
_LISTTENSORSREQUEST = DESCRIPTOR.message_types_by_name['ListTensorsRequest']
_LISTTENSORSRESPONSE = DESCRIPTOR.message_types_by_name['ListTensorsResponse']
_LISTTENSORSRESPONSE_RUNENTRY = _LISTTENSORSRESPONSE.nested_types_by_name['RunEntry']
_LISTTENSORSRESPONSE_TAGENTRY = _LISTTENSORSRESPONSE.nested_types_by_name['TagEntry']
_TENSORMETADATA = DESCRIPTOR.message_types_by_name['TensorMetadata']
_READTENSORSREQUEST = DESCRIPTOR.message_types_by_name['ReadTensorsRequest']
_READTENSORSRESPONSE = DESCRIPTOR.message_types_by_name['ReadTensorsResponse']
_READTENSORSRESPONSE_RUNENTRY = _READTENSORSRESPONSE.nested_types_by_name['RunEntry']
_READTENSORSRESPONSE_TAGENTRY = _READTENSORSRESPONSE.nested_types_by_name['TagEntry']
_TENSORDATA = DESCRIPTOR.message_types_by_name['TensorData']
_LISTBLOBSEQUENCESREQUEST = DESCRIPTOR.message_types_by_name['ListBlobSequencesRequest']
_LISTBLOBSEQUENCESRESPONSE = DESCRIPTOR.message_types_by_name['ListBlobSequencesResponse']
_LISTBLOBSEQUENCESRESPONSE_RUNENTRY = _LISTBLOBSEQUENCESRESPONSE.nested_types_by_name['RunEntry']
_LISTBLOBSEQUENCESRESPONSE_TAGENTRY = _LISTBLOBSEQUENCESRESPONSE.nested_types_by_name['TagEntry']
_BLOBSEQUENCEMETADATA = DESCRIPTOR.message_types_by_name['BlobSequenceMetadata']
_READBLOBSEQUENCESREQUEST = DESCRIPTOR.message_types_by_name['ReadBlobSequencesRequest']
_READBLOBSEQUENCESRESPONSE = DESCRIPTOR.message_types_by_name['ReadBlobSequencesResponse']
_READBLOBSEQUENCESRESPONSE_RUNENTRY = _READBLOBSEQUENCESRESPONSE.nested_types_by_name['RunEntry']
_READBLOBSEQUENCESRESPONSE_TAGENTRY = _READBLOBSEQUENCESRESPONSE.nested_types_by_name['TagEntry']
_BLOBSEQUENCEDATA = DESCRIPTOR.message_types_by_name['BlobSequenceData']
_BLOBREFERENCESEQUENCE = DESCRIPTOR.message_types_by_name['BlobReferenceSequence']
_BLOBREFERENCE = DESCRIPTOR.message_types_by_name['BlobReference']
_READBLOBREQUEST = DESCRIPTOR.message_types_by_name['ReadBlobRequest']
_READBLOBRESPONSE = DESCRIPTOR.message_types_by_name['ReadBlobResponse']
GetExperimentRequest = _reflection.GeneratedProtocolMessageType('GetExperimentRequest', (_message.Message,), {
'DESCRIPTOR' : _GETEXPERIMENTREQUEST,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.GetExperimentRequest)
})
_sym_db.RegisterMessage(GetExperimentRequest)
GetExperimentResponse = _reflection.GeneratedProtocolMessageType('GetExperimentResponse', (_message.Message,), {
'DESCRIPTOR' : _GETEXPERIMENTRESPONSE,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.GetExperimentResponse)
})
_sym_db.RegisterMessage(GetExperimentResponse)
PluginFilter = _reflection.GeneratedProtocolMessageType('PluginFilter', (_message.Message,), {
'DESCRIPTOR' : _PLUGINFILTER,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.PluginFilter)
})
_sym_db.RegisterMessage(PluginFilter)
RunTagFilter = _reflection.GeneratedProtocolMessageType('RunTagFilter', (_message.Message,), {
'DESCRIPTOR' : _RUNTAGFILTER,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.RunTagFilter)
})
_sym_db.RegisterMessage(RunTagFilter)
RunFilter = _reflection.GeneratedProtocolMessageType('RunFilter', (_message.Message,), {
'DESCRIPTOR' : _RUNFILTER,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.RunFilter)
})
_sym_db.RegisterMessage(RunFilter)
TagFilter = _reflection.GeneratedProtocolMessageType('TagFilter', (_message.Message,), {
'DESCRIPTOR' : _TAGFILTER,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.TagFilter)
})
_sym_db.RegisterMessage(TagFilter)
Downsample = _reflection.GeneratedProtocolMessageType('Downsample', (_message.Message,), {
'DESCRIPTOR' : _DOWNSAMPLE,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.Downsample)
})
_sym_db.RegisterMessage(Downsample)
ListPluginsRequest = _reflection.GeneratedProtocolMessageType('ListPluginsRequest', (_message.Message,), {
'DESCRIPTOR' : _LISTPLUGINSREQUEST,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.ListPluginsRequest)
})
_sym_db.RegisterMessage(ListPluginsRequest)
ListPluginsResponse = _reflection.GeneratedProtocolMessageType('ListPluginsResponse', (_message.Message,), {
'DESCRIPTOR' : _LISTPLUGINSRESPONSE,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.ListPluginsResponse)
})
_sym_db.RegisterMessage(ListPluginsResponse)
Plugin = _reflection.GeneratedProtocolMessageType('Plugin', (_message.Message,), {
'DESCRIPTOR' : _PLUGIN,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.Plugin)
})
_sym_db.RegisterMessage(Plugin)
ListRunsRequest = _reflection.GeneratedProtocolMessageType('ListRunsRequest', (_message.Message,), {
'DESCRIPTOR' : _LISTRUNSREQUEST,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.ListRunsRequest)
})
_sym_db.RegisterMessage(ListRunsRequest)
ListRunsResponse = _reflection.GeneratedProtocolMessageType('ListRunsResponse', (_message.Message,), {
'DESCRIPTOR' : _LISTRUNSRESPONSE,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.ListRunsResponse)
})
_sym_db.RegisterMessage(ListRunsResponse)
Run = _reflection.GeneratedProtocolMessageType('Run', (_message.Message,), {
'DESCRIPTOR' : _RUN,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.Run)
})
_sym_db.RegisterMessage(Run)
ListScalarsRequest = _reflection.GeneratedProtocolMessageType('ListScalarsRequest', (_message.Message,), {
'DESCRIPTOR' : _LISTSCALARSREQUEST,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.ListScalarsRequest)
})
_sym_db.RegisterMessage(ListScalarsRequest)
ListScalarsResponse = _reflection.GeneratedProtocolMessageType('ListScalarsResponse', (_message.Message,), {
'RunEntry' : _reflection.GeneratedProtocolMessageType('RunEntry', (_message.Message,), {
'DESCRIPTOR' : _LISTSCALARSRESPONSE_RUNENTRY,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.ListScalarsResponse.RunEntry)
})
,
'TagEntry' : _reflection.GeneratedProtocolMessageType('TagEntry', (_message.Message,), {
'DESCRIPTOR' : _LISTSCALARSRESPONSE_TAGENTRY,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.ListScalarsResponse.TagEntry)
})
,
'DESCRIPTOR' : _LISTSCALARSRESPONSE,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.ListScalarsResponse)
})
_sym_db.RegisterMessage(ListScalarsResponse)
_sym_db.RegisterMessage(ListScalarsResponse.RunEntry)
_sym_db.RegisterMessage(ListScalarsResponse.TagEntry)
ScalarMetadata = _reflection.GeneratedProtocolMessageType('ScalarMetadata', (_message.Message,), {
'DESCRIPTOR' : _SCALARMETADATA,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.ScalarMetadata)
})
_sym_db.RegisterMessage(ScalarMetadata)
ReadScalarsRequest = _reflection.GeneratedProtocolMessageType('ReadScalarsRequest', (_message.Message,), {
'DESCRIPTOR' : _READSCALARSREQUEST,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.ReadScalarsRequest)
})
_sym_db.RegisterMessage(ReadScalarsRequest)
ReadScalarsResponse = _reflection.GeneratedProtocolMessageType('ReadScalarsResponse', (_message.Message,), {
'RunEntry' : _reflection.GeneratedProtocolMessageType('RunEntry', (_message.Message,), {
'DESCRIPTOR' : _READSCALARSRESPONSE_RUNENTRY,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.ReadScalarsResponse.RunEntry)
})
,
'TagEntry' : _reflection.GeneratedProtocolMessageType('TagEntry', (_message.Message,), {
'DESCRIPTOR' : _READSCALARSRESPONSE_TAGENTRY,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.ReadScalarsResponse.TagEntry)
})
,
'DESCRIPTOR' : _READSCALARSRESPONSE,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.ReadScalarsResponse)
})
_sym_db.RegisterMessage(ReadScalarsResponse)
_sym_db.RegisterMessage(ReadScalarsResponse.RunEntry)
_sym_db.RegisterMessage(ReadScalarsResponse.TagEntry)
ScalarData = _reflection.GeneratedProtocolMessageType('ScalarData', (_message.Message,), {
'DESCRIPTOR' : _SCALARDATA,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.ScalarData)
})
_sym_db.RegisterMessage(ScalarData)
ListTensorsRequest = _reflection.GeneratedProtocolMessageType('ListTensorsRequest', (_message.Message,), {
'DESCRIPTOR' : _LISTTENSORSREQUEST,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.ListTensorsRequest)
})
_sym_db.RegisterMessage(ListTensorsRequest)
ListTensorsResponse = _reflection.GeneratedProtocolMessageType('ListTensorsResponse', (_message.Message,), {
'RunEntry' : _reflection.GeneratedProtocolMessageType('RunEntry', (_message.Message,), {
'DESCRIPTOR' : _LISTTENSORSRESPONSE_RUNENTRY,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.ListTensorsResponse.RunEntry)
})
,
'TagEntry' : _reflection.GeneratedProtocolMessageType('TagEntry', (_message.Message,), {
'DESCRIPTOR' : _LISTTENSORSRESPONSE_TAGENTRY,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.ListTensorsResponse.TagEntry)
})
,
'DESCRIPTOR' : _LISTTENSORSRESPONSE,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.ListTensorsResponse)
})
_sym_db.RegisterMessage(ListTensorsResponse)
_sym_db.RegisterMessage(ListTensorsResponse.RunEntry)
_sym_db.RegisterMessage(ListTensorsResponse.TagEntry)
TensorMetadata = _reflection.GeneratedProtocolMessageType('TensorMetadata', (_message.Message,), {
'DESCRIPTOR' : _TENSORMETADATA,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.TensorMetadata)
})
_sym_db.RegisterMessage(TensorMetadata)
ReadTensorsRequest = _reflection.GeneratedProtocolMessageType('ReadTensorsRequest', (_message.Message,), {
'DESCRIPTOR' : _READTENSORSREQUEST,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.ReadTensorsRequest)
})
_sym_db.RegisterMessage(ReadTensorsRequest)
ReadTensorsResponse = _reflection.GeneratedProtocolMessageType('ReadTensorsResponse', (_message.Message,), {
'RunEntry' : _reflection.GeneratedProtocolMessageType('RunEntry', (_message.Message,), {
'DESCRIPTOR' : _READTENSORSRESPONSE_RUNENTRY,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.ReadTensorsResponse.RunEntry)
})
,
'TagEntry' : _reflection.GeneratedProtocolMessageType('TagEntry', (_message.Message,), {
'DESCRIPTOR' : _READTENSORSRESPONSE_TAGENTRY,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.ReadTensorsResponse.TagEntry)
})
,
'DESCRIPTOR' : _READTENSORSRESPONSE,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.ReadTensorsResponse)
})
_sym_db.RegisterMessage(ReadTensorsResponse)
_sym_db.RegisterMessage(ReadTensorsResponse.RunEntry)
_sym_db.RegisterMessage(ReadTensorsResponse.TagEntry)
TensorData = _reflection.GeneratedProtocolMessageType('TensorData', (_message.Message,), {
'DESCRIPTOR' : _TENSORDATA,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.TensorData)
})
_sym_db.RegisterMessage(TensorData)
ListBlobSequencesRequest = _reflection.GeneratedProtocolMessageType('ListBlobSequencesRequest', (_message.Message,), {
'DESCRIPTOR' : _LISTBLOBSEQUENCESREQUEST,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.ListBlobSequencesRequest)
})
_sym_db.RegisterMessage(ListBlobSequencesRequest)
ListBlobSequencesResponse = _reflection.GeneratedProtocolMessageType('ListBlobSequencesResponse', (_message.Message,), {
'RunEntry' : _reflection.GeneratedProtocolMessageType('RunEntry', (_message.Message,), {
'DESCRIPTOR' : _LISTBLOBSEQUENCESRESPONSE_RUNENTRY,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.ListBlobSequencesResponse.RunEntry)
})
,
'TagEntry' : _reflection.GeneratedProtocolMessageType('TagEntry', (_message.Message,), {
'DESCRIPTOR' : _LISTBLOBSEQUENCESRESPONSE_TAGENTRY,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.ListBlobSequencesResponse.TagEntry)
})
,
'DESCRIPTOR' : _LISTBLOBSEQUENCESRESPONSE,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.ListBlobSequencesResponse)
})
_sym_db.RegisterMessage(ListBlobSequencesResponse)
_sym_db.RegisterMessage(ListBlobSequencesResponse.RunEntry)
_sym_db.RegisterMessage(ListBlobSequencesResponse.TagEntry)
BlobSequenceMetadata = _reflection.GeneratedProtocolMessageType('BlobSequenceMetadata', (_message.Message,), {
'DESCRIPTOR' : _BLOBSEQUENCEMETADATA,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.BlobSequenceMetadata)
})
_sym_db.RegisterMessage(BlobSequenceMetadata)
ReadBlobSequencesRequest = _reflection.GeneratedProtocolMessageType('ReadBlobSequencesRequest', (_message.Message,), {
'DESCRIPTOR' : _READBLOBSEQUENCESREQUEST,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.ReadBlobSequencesRequest)
})
_sym_db.RegisterMessage(ReadBlobSequencesRequest)
ReadBlobSequencesResponse = _reflection.GeneratedProtocolMessageType('ReadBlobSequencesResponse', (_message.Message,), {
'RunEntry' : _reflection.GeneratedProtocolMessageType('RunEntry', (_message.Message,), {
'DESCRIPTOR' : _READBLOBSEQUENCESRESPONSE_RUNENTRY,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.ReadBlobSequencesResponse.RunEntry)
})
,
'TagEntry' : _reflection.GeneratedProtocolMessageType('TagEntry', (_message.Message,), {
'DESCRIPTOR' : _READBLOBSEQUENCESRESPONSE_TAGENTRY,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.ReadBlobSequencesResponse.TagEntry)
})
,
'DESCRIPTOR' : _READBLOBSEQUENCESRESPONSE,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.ReadBlobSequencesResponse)
})
_sym_db.RegisterMessage(ReadBlobSequencesResponse)
_sym_db.RegisterMessage(ReadBlobSequencesResponse.RunEntry)
_sym_db.RegisterMessage(ReadBlobSequencesResponse.TagEntry)
BlobSequenceData = _reflection.GeneratedProtocolMessageType('BlobSequenceData', (_message.Message,), {
'DESCRIPTOR' : _BLOBSEQUENCEDATA,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.BlobSequenceData)
})
_sym_db.RegisterMessage(BlobSequenceData)
BlobReferenceSequence = _reflection.GeneratedProtocolMessageType('BlobReferenceSequence', (_message.Message,), {
'DESCRIPTOR' : _BLOBREFERENCESEQUENCE,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.BlobReferenceSequence)
})
_sym_db.RegisterMessage(BlobReferenceSequence)
BlobReference = _reflection.GeneratedProtocolMessageType('BlobReference', (_message.Message,), {
'DESCRIPTOR' : _BLOBREFERENCE,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.BlobReference)
})
_sym_db.RegisterMessage(BlobReference)
ReadBlobRequest = _reflection.GeneratedProtocolMessageType('ReadBlobRequest', (_message.Message,), {
'DESCRIPTOR' : _READBLOBREQUEST,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.ReadBlobRequest)
})
_sym_db.RegisterMessage(ReadBlobRequest)
ReadBlobResponse = _reflection.GeneratedProtocolMessageType('ReadBlobResponse', (_message.Message,), {
'DESCRIPTOR' : _READBLOBRESPONSE,
'__module__' : 'tensorboard.data.proto.data_provider_pb2'
# @@protoc_insertion_point(class_scope:tensorboard.data.ReadBlobResponse)
})
_sym_db.RegisterMessage(ReadBlobResponse)
_TENSORBOARDDATAPROVIDER = DESCRIPTOR.services_by_name['TensorBoardDataProvider']
if _descriptor._USE_C_DESCRIPTORS == False:
DESCRIPTOR._options = None
DESCRIPTOR._serialized_options = b'ZLgithub.com/tensorflow/tensorboard/tensorboard/data/proto/data_provider_proto'
_GETEXPERIMENTREQUEST._serialized_start=176
_GETEXPERIMENTREQUEST._serialized_end=221
_GETEXPERIMENTRESPONSE._serialized_start=224
_GETEXPERIMENTRESPONSE._serialized_end=356
_PLUGINFILTER._serialized_start=358
_PLUGINFILTER._serialized_end=393
_RUNTAGFILTER._serialized_start=395
_RUNTAGFILTER._serialized_end=495
_RUNFILTER._serialized_start=497
_RUNFILTER._serialized_end=523
_TAGFILTER._serialized_start=525
_TAGFILTER._serialized_end=551
_DOWNSAMPLE._serialized_start=553
_DOWNSAMPLE._serialized_end=585
_LISTPLUGINSREQUEST._serialized_start=587
_LISTPLUGINSREQUEST._serialized_end=630
_LISTPLUGINSRESPONSE._serialized_start=632
_LISTPLUGINSRESPONSE._serialized_end=696
_PLUGIN._serialized_start=698
_PLUGIN._serialized_end=720
_LISTRUNSREQUEST._serialized_start=722
_LISTRUNSREQUEST._serialized_end=762
_LISTRUNSRESPONSE._serialized_start=764
_LISTRUNSRESPONSE._serialized_end=819
_RUN._serialized_start=821
_RUN._serialized_end=870
_LISTSCALARSREQUEST._serialized_start=873
_LISTSCALARSREQUEST._serialized_end=1027
_LISTSCALARSRESPONSE._serialized_start=1030
_LISTSCALARSRESPONSE._serialized_end=1287
_LISTSCALARSRESPONSE_RUNENTRY._serialized_start=1115
_LISTSCALARSRESPONSE_RUNENTRY._serialized_end=1205
_LISTSCALARSRESPONSE_TAGENTRY._serialized_start=1207
_LISTSCALARSRESPONSE_TAGENTRY._serialized_end=1287
_SCALARMETADATA._serialized_start=1289
_SCALARMETADATA._serialized_end=1402
_READSCALARSREQUEST._serialized_start=1405
_READSCALARSREQUEST._serialized_end=1609
_READSCALARSRESPONSE._serialized_start=1612
_READSCALARSRESPONSE._serialized_end=1861
_READSCALARSRESPONSE_RUNENTRY._serialized_start=1697
_READSCALARSRESPONSE_RUNENTRY._serialized_end=1787
_READSCALARSRESPONSE_TAGENTRY._serialized_start=1789
_READSCALARSRESPONSE_TAGENTRY._serialized_end=1861
_SCALARDATA._serialized_start=1863
_SCALARDATA._serialized_end=1923
_LISTTENSORSREQUEST._serialized_start=1926
_LISTTENSORSREQUEST._serialized_end=2080
_LISTTENSORSRESPONSE._serialized_start=2083
_LISTTENSORSRESPONSE._serialized_end=2340
_LISTTENSORSRESPONSE_RUNENTRY._serialized_start=2168
_LISTTENSORSRESPONSE_RUNENTRY._serialized_end=2258
_LISTTENSORSRESPONSE_TAGENTRY._serialized_start=2260
_LISTTENSORSRESPONSE_TAGENTRY._serialized_end=2340
_TENSORMETADATA._serialized_start=2342
_TENSORMETADATA._serialized_end=2455
_READTENSORSREQUEST._serialized_start=2458
_READTENSORSREQUEST._serialized_end=2662
_READTENSORSRESPONSE._serialized_start=2665
_READTENSORSRESPONSE._serialized_end=2914
_READTENSORSRESPONSE_RUNENTRY._serialized_start=2750
_READTENSORSRESPONSE_RUNENTRY._serialized_end=2840
_READTENSORSRESPONSE_TAGENTRY._serialized_start=2842
_READTENSORSRESPONSE_TAGENTRY._serialized_end=2914
_TENSORDATA._serialized_start=2916
_TENSORDATA._serialized_end=3002
_LISTBLOBSEQUENCESREQUEST._serialized_start=3005
_LISTBLOBSEQUENCESREQUEST._serialized_end=3165
_LISTBLOBSEQUENCESRESPONSE._serialized_start=3168
_LISTBLOBSEQUENCESRESPONSE._serialized_end=3449
_LISTBLOBSEQUENCESRESPONSE_RUNENTRY._serialized_start=3265
_LISTBLOBSEQUENCESRESPONSE_RUNENTRY._serialized_end=3361
_LISTBLOBSEQUENCESRESPONSE_TAGENTRY._serialized_start=3363
_LISTBLOBSEQUENCESRESPONSE_TAGENTRY._serialized_end=3449
_BLOBSEQUENCEMETADATA._serialized_start=3452
_BLOBSEQUENCEMETADATA._serialized_end=3591
_READBLOBSEQUENCESREQUEST._serialized_start=3594
_READBLOBSEQUENCESREQUEST._serialized_end=3804
_READBLOBSEQUENCESRESPONSE._serialized_start=3807
_READBLOBSEQUENCESRESPONSE._serialized_end=4080
_READBLOBSEQUENCESRESPONSE_RUNENTRY._serialized_start=3904
_READBLOBSEQUENCESRESPONSE_RUNENTRY._serialized_end=4000
_READBLOBSEQUENCESRESPONSE_TAGENTRY._serialized_start=4002
_READBLOBSEQUENCESRESPONSE_TAGENTRY._serialized_end=4080
_BLOBSEQUENCEDATA._serialized_start=4082
_BLOBSEQUENCEDATA._serialized_end=4190
_BLOBREFERENCESEQUENCE._serialized_start=4192
_BLOBREFERENCESEQUENCE._serialized_end=4267
_BLOBREFERENCE._serialized_start=4269
_BLOBREFERENCE._serialized_end=4315
_READBLOBREQUEST._serialized_start=4317
_READBLOBREQUEST._serialized_end=4352
_READBLOBRESPONSE._serialized_start=4354
_READBLOBRESPONSE._serialized_end=4386
_TENSORBOARDDATAPROVIDER._serialized_start=4389
_TENSORBOARDDATAPROVIDER._serialized_end=5378
# @@protoc_insertion_point(module_scope)
@@ -0,0 +1,374 @@
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
from tensorboard.data.proto import data_provider_pb2 as tensorboard_dot_data_dot_proto_dot_data__provider__pb2
class TensorBoardDataProviderStub(object):
"""Missing associated documentation comment in .proto file."""
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
self.GetExperiment = channel.unary_unary(
'/tensorboard.data.TensorBoardDataProvider/GetExperiment',
request_serializer=tensorboard_dot_data_dot_proto_dot_data__provider__pb2.GetExperimentRequest.SerializeToString,
response_deserializer=tensorboard_dot_data_dot_proto_dot_data__provider__pb2.GetExperimentResponse.FromString,
)
self.ListPlugins = channel.unary_unary(
'/tensorboard.data.TensorBoardDataProvider/ListPlugins',
request_serializer=tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ListPluginsRequest.SerializeToString,
response_deserializer=tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ListPluginsResponse.FromString,
)
self.ListRuns = channel.unary_unary(
'/tensorboard.data.TensorBoardDataProvider/ListRuns',
request_serializer=tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ListRunsRequest.SerializeToString,
response_deserializer=tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ListRunsResponse.FromString,
)
self.ListScalars = channel.unary_unary(
'/tensorboard.data.TensorBoardDataProvider/ListScalars',
request_serializer=tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ListScalarsRequest.SerializeToString,
response_deserializer=tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ListScalarsResponse.FromString,
)
self.ReadScalars = channel.unary_unary(
'/tensorboard.data.TensorBoardDataProvider/ReadScalars',
request_serializer=tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ReadScalarsRequest.SerializeToString,
response_deserializer=tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ReadScalarsResponse.FromString,
)
self.ListTensors = channel.unary_unary(
'/tensorboard.data.TensorBoardDataProvider/ListTensors',
request_serializer=tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ListTensorsRequest.SerializeToString,
response_deserializer=tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ListTensorsResponse.FromString,
)
self.ReadTensors = channel.unary_unary(
'/tensorboard.data.TensorBoardDataProvider/ReadTensors',
request_serializer=tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ReadTensorsRequest.SerializeToString,
response_deserializer=tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ReadTensorsResponse.FromString,
)
self.ListBlobSequences = channel.unary_unary(
'/tensorboard.data.TensorBoardDataProvider/ListBlobSequences',
request_serializer=tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ListBlobSequencesRequest.SerializeToString,
response_deserializer=tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ListBlobSequencesResponse.FromString,
)
self.ReadBlobSequences = channel.unary_unary(
'/tensorboard.data.TensorBoardDataProvider/ReadBlobSequences',
request_serializer=tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ReadBlobSequencesRequest.SerializeToString,
response_deserializer=tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ReadBlobSequencesResponse.FromString,
)
self.ReadBlob = channel.unary_stream(
'/tensorboard.data.TensorBoardDataProvider/ReadBlob',
request_serializer=tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ReadBlobRequest.SerializeToString,
response_deserializer=tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ReadBlobResponse.FromString,
)
class TensorBoardDataProviderServicer(object):
"""Missing associated documentation comment in .proto file."""
def GetExperiment(self, request, context):
"""Get metadata about an experiment.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def ListPlugins(self, request, context):
"""List plugins that have data for an experiment.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def ListRuns(self, request, context):
"""List runs within an experiment.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def ListScalars(self, request, context):
"""List metadata about scalar time series.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def ReadScalars(self, request, context):
"""Read data from scalar time series.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def ListTensors(self, request, context):
"""List metadata about tensor time series.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def ReadTensors(self, request, context):
"""Read data from tensor time series.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def ListBlobSequences(self, request, context):
"""List metadata about blob sequence time series.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def ReadBlobSequences(self, request, context):
"""Read blob references from blob sequence time series. See `ReadBlob` to read
the actual blob data.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def ReadBlob(self, request, context):
"""Read data for a specific blob.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def add_TensorBoardDataProviderServicer_to_server(servicer, server):
rpc_method_handlers = {
'GetExperiment': grpc.unary_unary_rpc_method_handler(
servicer.GetExperiment,
request_deserializer=tensorboard_dot_data_dot_proto_dot_data__provider__pb2.GetExperimentRequest.FromString,
response_serializer=tensorboard_dot_data_dot_proto_dot_data__provider__pb2.GetExperimentResponse.SerializeToString,
),
'ListPlugins': grpc.unary_unary_rpc_method_handler(
servicer.ListPlugins,
request_deserializer=tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ListPluginsRequest.FromString,
response_serializer=tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ListPluginsResponse.SerializeToString,
),
'ListRuns': grpc.unary_unary_rpc_method_handler(
servicer.ListRuns,
request_deserializer=tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ListRunsRequest.FromString,
response_serializer=tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ListRunsResponse.SerializeToString,
),
'ListScalars': grpc.unary_unary_rpc_method_handler(
servicer.ListScalars,
request_deserializer=tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ListScalarsRequest.FromString,
response_serializer=tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ListScalarsResponse.SerializeToString,
),
'ReadScalars': grpc.unary_unary_rpc_method_handler(
servicer.ReadScalars,
request_deserializer=tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ReadScalarsRequest.FromString,
response_serializer=tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ReadScalarsResponse.SerializeToString,
),
'ListTensors': grpc.unary_unary_rpc_method_handler(
servicer.ListTensors,
request_deserializer=tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ListTensorsRequest.FromString,
response_serializer=tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ListTensorsResponse.SerializeToString,
),
'ReadTensors': grpc.unary_unary_rpc_method_handler(
servicer.ReadTensors,
request_deserializer=tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ReadTensorsRequest.FromString,
response_serializer=tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ReadTensorsResponse.SerializeToString,
),
'ListBlobSequences': grpc.unary_unary_rpc_method_handler(
servicer.ListBlobSequences,
request_deserializer=tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ListBlobSequencesRequest.FromString,
response_serializer=tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ListBlobSequencesResponse.SerializeToString,
),
'ReadBlobSequences': grpc.unary_unary_rpc_method_handler(
servicer.ReadBlobSequences,
request_deserializer=tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ReadBlobSequencesRequest.FromString,
response_serializer=tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ReadBlobSequencesResponse.SerializeToString,
),
'ReadBlob': grpc.unary_stream_rpc_method_handler(
servicer.ReadBlob,
request_deserializer=tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ReadBlobRequest.FromString,
response_serializer=tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ReadBlobResponse.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'tensorboard.data.TensorBoardDataProvider', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
# This class is part of an EXPERIMENTAL API.
class TensorBoardDataProvider(object):
"""Missing associated documentation comment in .proto file."""
@staticmethod
def GetExperiment(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/tensorboard.data.TensorBoardDataProvider/GetExperiment',
tensorboard_dot_data_dot_proto_dot_data__provider__pb2.GetExperimentRequest.SerializeToString,
tensorboard_dot_data_dot_proto_dot_data__provider__pb2.GetExperimentResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def ListPlugins(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/tensorboard.data.TensorBoardDataProvider/ListPlugins',
tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ListPluginsRequest.SerializeToString,
tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ListPluginsResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def ListRuns(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/tensorboard.data.TensorBoardDataProvider/ListRuns',
tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ListRunsRequest.SerializeToString,
tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ListRunsResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def ListScalars(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/tensorboard.data.TensorBoardDataProvider/ListScalars',
tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ListScalarsRequest.SerializeToString,
tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ListScalarsResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def ReadScalars(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/tensorboard.data.TensorBoardDataProvider/ReadScalars',
tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ReadScalarsRequest.SerializeToString,
tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ReadScalarsResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def ListTensors(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/tensorboard.data.TensorBoardDataProvider/ListTensors',
tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ListTensorsRequest.SerializeToString,
tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ListTensorsResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def ReadTensors(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/tensorboard.data.TensorBoardDataProvider/ReadTensors',
tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ReadTensorsRequest.SerializeToString,
tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ReadTensorsResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def ListBlobSequences(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/tensorboard.data.TensorBoardDataProvider/ListBlobSequences',
tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ListBlobSequencesRequest.SerializeToString,
tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ListBlobSequencesResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def ReadBlobSequences(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/tensorboard.data.TensorBoardDataProvider/ReadBlobSequences',
tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ReadBlobSequencesRequest.SerializeToString,
tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ReadBlobSequencesResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def ReadBlob(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_stream(request, target, '/tensorboard.data.TensorBoardDataProvider/ReadBlob',
tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ReadBlobRequest.SerializeToString,
tensorboard_dot_data_dot_proto_dot_data__provider__pb2.ReadBlobResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@@ -0,0 +1,302 @@
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Provides data ingestion logic backed by a gRPC server."""
import errno
import logging
import os
import subprocess
import tempfile
import time
import grpc
import pkg_resources
from tensorboard.data import grpc_provider
from tensorboard.data import ingester
from tensorboard.data.proto import data_provider_pb2
from tensorboard.util import tb_logging
logger = tb_logging.get_logger()
# If this environment variable is non-empty, it will be used as the path to the
# data server binary rather than using a bundled version.
_ENV_DATA_SERVER_BINARY = "TENSORBOARD_DATA_SERVER_BINARY"
class ExistingServerDataIngester(ingester.DataIngester):
"""Connect to an already running gRPC server."""
def __init__(self, address, *, channel_creds_type):
"""Initializes an ingester with the given configuration.
Args:
address: String, as passed to `--grpc_data_provider`.
channel_creds_type: `grpc_util.ChannelCredsType`, as passed to
`--grpc_creds_type`.
"""
stub = _make_stub(address, channel_creds_type)
self._data_provider = grpc_provider.GrpcDataProvider(address, stub)
@property
def data_provider(self):
return self._data_provider
def start(self):
pass
class SubprocessServerDataIngester(ingester.DataIngester):
"""Start a new data server as a subprocess."""
def __init__(
self,
server_binary,
logdir,
*,
reload_interval,
channel_creds_type,
samples_per_plugin=None,
extra_flags=None,
):
"""Initializes an ingester with the given configuration.
Args:
server_binary: `ServerBinary` to launch.
logdir: String, as passed to `--logdir`.
reload_interval: Number, as passed to `--reload_interval`.
channel_creds_type: `grpc_util.ChannelCredsType`, as passed to
`--grpc_creds_type`.
samples_per_plugin: Dict[String, Int], as parsed from
`--samples_per_plugin`.
extra_flags: List of extra string flags to be passed to the
data server without further interpretation.
"""
self._server_binary = server_binary
self._data_provider = None
self._logdir = logdir
self._reload_interval = reload_interval
self._channel_creds_type = channel_creds_type
self._samples_per_plugin = samples_per_plugin or {}
self._extra_flags = list(extra_flags or [])
@property
def data_provider(self):
if self._data_provider is None:
raise RuntimeError("Must call `start` first")
return self._data_provider
def start(self):
if self._data_provider:
return
tmpdir = tempfile.TemporaryDirectory(prefix="tensorboard_data_server_")
port_file_path = os.path.join(tmpdir.name, "port")
error_file_path = os.path.join(tmpdir.name, "startup_error")
if self._reload_interval <= 0:
reload = "once"
else:
reload = str(int(self._reload_interval))
sample_hint_pairs = [
"%s=%s" % (k, "all" if v == 0 else v)
for k, v in self._samples_per_plugin.items()
]
samples_per_plugin = ",".join(sample_hint_pairs)
args = [
self._server_binary.path,
"--logdir=%s" % os.path.expanduser(self._logdir),
"--reload=%s" % reload,
"--samples-per-plugin=%s" % samples_per_plugin,
"--port=0",
"--port-file=%s" % (port_file_path,),
"--die-after-stdin",
]
if self._server_binary.at_least_version("0.5.0a0"):
args.append("--error-file=%s" % (error_file_path,))
if logger.isEnabledFor(logging.INFO):
args.append("--verbose")
if logger.isEnabledFor(logging.DEBUG):
args.append("--verbose") # Repeat arg to increase verbosity.
args.extend(self._extra_flags)
logger.info("Spawning data server: %r", args)
popen = subprocess.Popen(args, stdin=subprocess.PIPE)
# Stash stdin to avoid calling its destructor: on Windows, this
# is a `subprocess.Handle` that closes itself in `__del__`,
# which would cause the data server to shut down. (This is not
# documented; you have to read CPython source to figure it out.)
# We want that to happen at end of process, but not before.
self._stdin_handle = popen.stdin # stash to avoid stdin being closed
port = None
# The server only needs about 10 microseconds to spawn on my machine,
# but give a few orders of magnitude of padding, and then poll.
time.sleep(0.01)
for i in range(20):
if popen.poll() is not None:
msg = (_maybe_read_file(error_file_path) or "").strip()
if not msg:
msg = (
"exited with %d; check stderr for details"
% popen.poll()
)
raise DataServerStartupError(msg)
logger.info("Polling for data server port (attempt %d)", i)
port_file_contents = _maybe_read_file(port_file_path)
logger.info("Port file contents: %r", port_file_contents)
if (port_file_contents or "").endswith("\n"):
port = int(port_file_contents)
break
# Else, not done writing yet.
time.sleep(0.5)
if port is None:
raise DataServerStartupError(
"Timed out while waiting for data server to start. "
"It may still be running as pid %d." % popen.pid
)
addr = "localhost:%d" % port
stub = _make_stub(addr, self._channel_creds_type)
logger.info(
"Opened channel to data server at pid %d via %s",
popen.pid,
addr,
)
req = data_provider_pb2.GetExperimentRequest()
try:
stub.GetExperiment(req, timeout=5) # should be near-instant
except grpc.RpcError as e:
msg = "Failed to communicate with data server at %s: %s" % (addr, e)
logging.warning("%s", msg)
raise DataServerStartupError(msg) from e
logger.info("Got valid response from data server")
self._data_provider = grpc_provider.GrpcDataProvider(addr, stub)
def _maybe_read_file(path):
"""Read a file, or return `None` on ENOENT specifically."""
try:
with open(path) as infile:
return infile.read()
except OSError as e:
if e.errno == errno.ENOENT:
return None
raise
def _make_stub(addr, channel_creds_type):
(creds, options) = channel_creds_type.channel_config()
options.append(("grpc.max_receive_message_length", 1024 * 1024 * 256))
channel = grpc.secure_channel(addr, creds, options=options)
return grpc_provider.make_stub(channel)
class NoDataServerError(RuntimeError):
pass
class DataServerStartupError(RuntimeError):
pass
class ServerBinary:
"""Information about a data server binary."""
def __init__(self, path, version):
"""Initializes a `ServerBinary`.
Args:
path: String path to executable on disk.
version: PEP 396-compliant version string, or `None` if
unknown or not applicable. Binaries at unknown versions are
assumed to be bleeding-edge: if you bring your own binary,
it's on you to make sure that it's up to date.
"""
self._path = path
self._version = (
pkg_resources.parse_version(version)
if version is not None
else version
)
@property
def path(self):
return self._path
def at_least_version(self, required_version):
"""Test whether the binary's version is at least the given one.
Useful for gating features that are available in the latest data
server builds from head, but not yet released to PyPI. For
example, if v0.4.0 is the latest published version, you can
check `at_least_version("0.5.0a0")` to include both prereleases
at head and the eventual final release of v0.5.0.
If this binary's version was set to `None` at construction time,
this method always returns `True`.
Args:
required_version: PEP 396-compliant version string.
Returns:
Boolean.
"""
if self._version is None:
return True
return self._version >= pkg_resources.parse_version(required_version)
def get_server_binary():
"""Get `ServerBinary` info or raise `NoDataServerError`."""
env_result = os.environ.get(_ENV_DATA_SERVER_BINARY)
if env_result:
logging.info("Server binary (from env): %s", env_result)
if not os.path.isfile(env_result):
raise NoDataServerError(
"Found environment variable %s=%s, but no such file exists."
% (_ENV_DATA_SERVER_BINARY, env_result)
)
return ServerBinary(env_result, version=None)
bundle_result = os.path.join(os.path.dirname(__file__), "server", "server")
if os.path.exists(bundle_result):
logging.info("Server binary (from bundle): %s", bundle_result)
return ServerBinary(bundle_result, version=None)
try:
import tensorboard_data_server
except ImportError:
pass
else:
pkg_result = tensorboard_data_server.server_binary()
version = tensorboard_data_server.__version__
logging.info(
"Server binary (from Python package v%s): %s", version, pkg_result
)
if pkg_result is None:
raise NoDataServerError(
"TensorBoard data server not supported on this platform."
)
return ServerBinary(pkg_result, version)
raise NoDataServerError(
"TensorBoard data server not found. This mode is experimental. "
"If building from source, pass --define=link_data_server=true."
)