Constructs TensorBoardWSGI instance. Args: plugins: A list of base_plugin.TBPlugin subclass instances. path_prefix: A prefix of the path when app isn't served from root. data_provider: `tensorboard.data.provider.DataProvider` or `None`; if present,
(
self,
plugins,
path_prefix="",
data_provider=None,
experimental_plugins=None,
auth_providers=None,
experimental_middlewares=None,
)
| 174 | """The TensorBoard WSGI app that delegates to a set of TBPlugin.""" |
| 175 | |
| 176 | def __init__( |
| 177 | self, |
| 178 | plugins, |
| 179 | path_prefix="", |
| 180 | data_provider=None, |
| 181 | experimental_plugins=None, |
| 182 | auth_providers=None, |
| 183 | experimental_middlewares=None, |
| 184 | ): |
| 185 | """Constructs TensorBoardWSGI instance. |
| 186 | |
| 187 | Args: |
| 188 | plugins: A list of base_plugin.TBPlugin subclass instances. |
| 189 | path_prefix: A prefix of the path when app isn't served from root. |
| 190 | data_provider: `tensorboard.data.provider.DataProvider` or |
| 191 | `None`; if present, will inform the "active" state of |
| 192 | `/plugins_listing`. |
| 193 | experimental_plugins: A list of plugin names that are only provided |
| 194 | experimentally. The corresponding plugins will only be activated for |
| 195 | a user if the user has specified the plugin with the experimentalPlugin |
| 196 | query parameter in the URL. |
| 197 | auth_providers: Optional mapping whose values are `AuthProvider` |
| 198 | values and whose keys are used by (e.g.) data providers to specify |
| 199 | `AuthProvider`s via the `AuthContext.get` interface. |
| 200 | Defaults to `{}`. |
| 201 | experimental_middlewares: Optional list of WSGI middlewares to apply |
| 202 | directly around the core TensorBoard app itself. Defaults to `[]`. |
| 203 | This parameter is experimental and may be reworked or removed. |
| 204 | |
| 205 | Returns: |
| 206 | A WSGI application for the set of all TBPlugin instances. |
| 207 | |
| 208 | Raises: |
| 209 | ValueError: If some plugin has no plugin_name |
| 210 | ValueError: If some plugin has an invalid plugin_name (plugin |
| 211 | names must only contain [A-Za-z0-9_.-]) |
| 212 | ValueError: If two plugins have the same plugin_name |
| 213 | ValueError: If some plugin handles a route that does not start |
| 214 | with a slash |
| 215 | |
| 216 | :type plugins: list[base_plugin.TBPlugin] |
| 217 | """ |
| 218 | self._plugins = plugins |
| 219 | self._path_prefix = path_prefix |
| 220 | self._data_provider = data_provider |
| 221 | self._experimental_plugins = frozenset(experimental_plugins or ()) |
| 222 | self._auth_providers = auth_providers or {} |
| 223 | self._extra_middlewares = list(experimental_middlewares or []) |
| 224 | if self._path_prefix.endswith("/"): |
| 225 | # Should have been fixed by `fix_flags`. |
| 226 | raise ValueError( |
| 227 | "Trailing slash in path prefix: %r" % self._path_prefix |
| 228 | ) |
| 229 | |
| 230 | self.exact_routes = { |
| 231 | # TODO(@chihuahua): Delete this RPC once we have skylark rules that |
| 232 | # obviate the need for the frontend to determine which plugins are |
| 233 | # active. |
nothing calls this directly
no test coverage detected