def setUp(self):
        self.context = None
        dummy_assets_zip_provider = lambda: None
        # The application should have added routes for both plugins.
        self.app = application.standard_tensorboard_wsgi(
            FakeFlags(logdir=self.get_temp_dir()), [
                base_plugin.BasicLoader(
                    functools.partial(
                        FakePlugin,
                        plugin_name='foo',
                        is_active_value=True,
                        routes_mapping={'/foo_route': self._foo_handler},
                        construction_callback=self._construction_callback)),
                base_plugin.BasicLoader(
                    functools.partial(
                        FakePlugin,
                        plugin_name='bar',
                        is_active_value=True,
                        routes_mapping={
                            '/bar_route': self._bar_handler,
                            '/wildcard/*': self._wildcard_handler,
                            '/wildcard/special/*':
                            self._wildcard_special_handler,
                            '/wildcard/special/exact': self._foo_handler,
                        },
                        construction_callback=self._construction_callback)),
            ], dummy_assets_zip_provider)

        self.server = werkzeug_test.Client(self.app, wrappers.BaseResponse)
Example #2
0
 def make_loader(plugin):
     if isinstance(plugin, base_plugin.TBLoader):
         return plugin
     if issubclass(plugin, base_plugin.TBPlugin):
         return base_plugin.BasicLoader(plugin)
     raise ValueError("Not a TBLoader or TBPlugin subclass: %s" %
                      plugin)
 def setUp(self):
     self.context = None
     # The application should have added routes for both plugins.
     self.app = application.standard_tensorboard_wsgi(
         FakeFlags(logdir=self.get_temp_dir()), [
             base_plugin.BasicLoader(
                 functools.partial(
                     FakePlugin,
                     plugin_name='foo',
                     is_active_value=True,
                     routes_mapping={'/foo_route': self._foo_handler},
                     construction_callback=self._construction_callback)),
             base_plugin.BasicLoader(
                 functools.partial(
                     FakePlugin,
                     plugin_name='bar',
                     is_active_value=True,
                     routes_mapping={'/bar_route': self._bar_handler},
                     construction_callback=self._construction_callback)),
         ], default.get_assets_zip_provider())
Example #4
0
def make_plugin_loader(plugin_spec):
  """Returns a plugin loader for the given plugin.

  Args:
    plugin_spec: A TBPlugin subclass, or a TBLoader instance or subclass.

  Returns:
    A TBLoader for the given plugin.
  """
  if isinstance(plugin_spec, base_plugin.TBLoader):
    return plugin_spec
  if isinstance(plugin_spec, type):
    if issubclass(plugin_spec, base_plugin.TBLoader):
      return plugin_spec()
    if issubclass(plugin_spec, base_plugin.TBPlugin):
      return base_plugin.BasicLoader(plugin_spec)
  raise TypeError("Not a TBLoader or TBPlugin subclass: %r" % (plugin_spec,))
Example #5
0
from tensorboard.plugins.distribution import distributions_plugin
from tensorboard.plugins.graph import graphs_plugin
from tensorboard.plugins.debugger import debugger_plugin_loader
from tensorboard.plugins.histogram import histograms_plugin
from tensorboard.plugins.image import images_plugin
from tensorboard.plugins.pr_curve import pr_curves_plugin
from tensorboard.plugins.profile import profile_plugin
from tensorboard.plugins.projector import projector_plugin
from tensorboard.plugins.scalar import scalars_plugin
from tensorboard.plugins.text import text_plugin

logger = logging.getLogger(__name__)

PLUGIN_LOADERS = [
    core_plugin.CorePluginLoader(),
    base_plugin.BasicLoader(beholder_plugin.BeholderPlugin),
    base_plugin.BasicLoader(scalars_plugin.ScalarsPlugin),
    base_plugin.BasicLoader(custom_scalars_plugin.CustomScalarsPlugin),
    base_plugin.BasicLoader(images_plugin.ImagesPlugin),
    base_plugin.BasicLoader(audio_plugin.AudioPlugin),
    base_plugin.BasicLoader(graphs_plugin.GraphsPlugin),
    base_plugin.BasicLoader(distributions_plugin.DistributionsPlugin),
    base_plugin.BasicLoader(histograms_plugin.HistogramsPlugin),
    base_plugin.BasicLoader(pr_curves_plugin.PrCurvesPlugin),
    base_plugin.BasicLoader(projector_plugin.ProjectorPlugin),
    base_plugin.BasicLoader(text_plugin.TextPlugin),
    profile_plugin.ProfilePluginLoader(),
    debugger_plugin_loader.DebuggerPluginLoader(),
]