-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
Description
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
- Migrate callers of TensorBoardWSGIApp users to TensorBoardWSGI + explicit
Reload()- done in Refactor away TensorBoardWSGIApp in its current form #2575 - Reorganize the logic in standard_tb_wsgi() so that first half creates the multiplexer + launches reloading, second half creates the TBContext and instantiates plugins - done in Refactor away TensorBoardWSGIApp in its current form #2575
- Factor out second half of standard_tb_wsgi() as a reincarnated TensorBoardWSGIApp entry point that accepts data_provider (and multiplexer as the legacy option) - done in Reincarnate TensorBoardWSGIApp as new DataProvider-friendly entry point #2576
- Encapsulate standard_tb_wsgi() multiplexer creation and reloading logic into new LocalDataIngester construct - done in refactor: slice the two-headed application.py monster in half #3643
- Move multiplexer-related bits of application.py into a separate file - done in refactor: slice the two-headed application.py monster in half #3643
- Refactor program.py to create LocalDataIngester manually, and get rid of standard_tensorboard_wsgi() - done in refactor: slice the two-headed application.py monster in half #3643
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): ...)
- could do this by implementing
- 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
- Move CorePlugin flag definitions into other places as described in Eliminate passing of untyped CLI flags across API boundaries #2801
- Move CorePlugin routes onto TensorBoardWSGIApp itself