Skip to content

Restructure the WSGI app for easier direct use #2573

@nfelt

Description

@nfelt

This issue tracks refactoring the main TensorBoard WSGI app to make it easier to use the app as a standalone WSGI app (rather than only via the tensorboard CLI).

The essential stream of work is the "core" stream below, but it leaves behind a lot of cleanup that we should at least partially address as well.

CORE

CLEANUP: WSGI

  • Create dispatch middleware for mapping WSGI apps to paths
  • Change path_prefix to be application of dispatch middleware to TensorBoardWSGIApp, rather than built-in feature - partly done in application: extract path prefix logic to middleware #2733
  • Make each plugin itself a WSGI app, so that their backends can be tested entirely independent of the main TB app, and remove calls to TensorBoardWSGI
    • could do this by implementing __call__ in BasePlugin using dispatch middleware plus get_plugin_apps()?
    • could change get_plugin_apps() to memoized default implementation that searches class for attributes carrying a special tag, and use a method decorator to apply this tag to the individual routes (e.g. @tb_route("/tags") def tags_route(self, request): ...)
  • Refactor away TensorBoardWSGI inner surface (move plugin route aggregation logic into a helper that we can test directly)
  • Change TensorBoardWSGIApp.__call__() to just use dispatch middleware logic

CLEANUP: CORE PLUGIN

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions