tensorflow / tensorflow/tensorboard
Restructure the WSGI app for easier direct use
Open
Nobody has claimed this yet.
core:backend
type:cleanup
- Dominant language
- TypeScript
- Stars
- 7.2k
- Forks
- 1.7k
- Avg merge
- 4d 22h
- Merged PRs (30d)
- 1
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 #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 #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 #2576
- Encapsulate standard_tb_wsgi() multiplexer creation and reloading logic into new LocalDataIngester construct - done in #3643
- Move multiplexer-related bits of application.py into a separate file - done in #3643
- Refactor program.py to create LocalDataIngester manually, and get rid of standard_tensorboard_wsgi() - done in #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 #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 #2801
- Move CorePlugin routes onto TensorBoardWSGIApp itself
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.