Construct a TensorBoardWSGIApp with standard plugins and multiplexer.

  Args:
    flags: An argparse.Namespace containing TensorBoard CLI flags.
    plugin_loaders: A list of TBLoader instances.
    assets_zip_provider: See TBContext documentation for more information.

  Returns:
    The new TensorBoard WSGI application.

  :type plugin_loaders: list[base_plugin.TBLoader]
  :rtype: TensorBoardWSGI

def standard_tensorboard_wsgi(flags, plugin_loaders, assets_zip_provider):
  """Construct a TensorBoardWSGIApp with standard plugins and multiplexer.

  Args:
    flags: An argparse.Namespace containing TensorBoard CLI flags.
    plugin_loaders: A list of TBLoader instances.
    assets_zip_provider: See TBContext documentation for more information.

  Returns:
    The new TensorBoard WSGI application.

  :type plugin_loaders: list[base_plugin.TBLoader]
  :rtype: TensorBoardWSGI
  """
  multiplexer = event_multiplexer.EventMultiplexer(
      size_guidance=DEFAULT_SIZE_GUIDANCE,
      tensor_size_guidance=tensor_size_guidance_from_flags(flags),
      purge_orphaned_data=flags.purge_orphaned_data,
      max_reload_threads=flags.max_reload_threads)
  loading_multiplexer = multiplexer
  reload_interval = flags.reload_interval
  # For db import op mode, prefer reloading in a child process. See
  # https://github.com/tensorflow/tensorboard/issues/1467
  reload_task = flags.reload_task
  if reload_task == 'auto' and flags.db_import and flags.db_import_use_op:
    reload_task == 'process'
  db_uri = flags.db
  # For DB import mode, create a DB file if we weren't given one.
  if flags.db_import and not flags.db:
    tmpdir = tempfile.mkdtemp(prefix='tbimport')
    atexit.register(shutil.rmtree, tmpdir)
    db_uri = 'sqlite:%s/tmp.sqlite' % tmpdir
  db_module, db_connection_provider = get_database_info(db_uri)
  if flags.db_import:
    # DB import mode.
    if db_module != sqlite3:
      raise base_plugin.FlagsError('--db_import is only compatible with sqlite DBs')
    logger.info('Importing logdir into DB at %s', db_uri)
    loading_multiplexer = db_import_multiplexer.DbImportMultiplexer(
        db_connection_provider=db_connection_provider,
        purge_orphaned_data=flags.purge_orphaned_data,
        max_reload_threads=flags.max_reload_threads,
        use_import_op=flags.db_import_use_op)
  elif flags.db:
    # DB read-only mode, never load event logs.
    reload_interval = -1
  plugin_name_to_instance = {}
  context = base_plugin.TBContext(
      db_module=db_module,
      db_connection_provider=db_connection_provider,
      db_uri=db_uri,
      flags=flags,
      logdir=flags.logdir,
      multiplexer=multiplexer,
      assets_zip_provider=assets_zip_provider,
      plugin_name_to_instance=plugin_name_to_instance,
      window_title=flags.window_title)
  plugins = []
  for loader in plugin_loaders:
    plugin = loader.load(context)
    if plugin is None:
      continue
    plugins.append(plugin)
    plugin_name_to_instance[plugin.plugin_name] = plugin
  return TensorBoardWSGIApp(flags.logdir, plugins, loading_multiplexer,
                            reload_interval, flags.path_prefix,
                            reload_task)