Beispiel #1
0
def run_main():
    """Initializes flags and calls main()."""
    program.setup_environment()

    if getattr(tf, "__version__", "stub") == "stub":
        print(
            "TensorFlow installation not found - running with reduced feature set.",
            file=sys.stderr,
        )

    tensorboard = program.TensorBoard(
        default.get_plugins(),
        program.get_default_assets_zip_provider(),
        subcommands=[uploader_subcommand.UploaderSubcommand()],
    )
    try:
        from absl import app

        # Import this to check that app.run() will accept the flags_parser argument.
        from absl.flags import argparse_flags

        app.run(tensorboard.main, flags_parser=tensorboard.configure)
        raise AssertionError("absl.app.run() shouldn't return")
    except ImportError:
        pass
    except base_plugin.FlagsError as e:
        print("Error: %s" % e, file=sys.stderr)
        sys.exit(1)

    tensorboard.configure(sys.argv)
    sys.exit(tensorboard.main())
Beispiel #2
0
def run_main():
    """Initializes flags and calls main()."""
    main_lib.global_init()

    tensorboard = program.TensorBoard(
        plugins=default.get_plugins(),
        subcommands=[uploader_subcommand.UploaderSubcommand()],
    )
    try:
        app.run(tensorboard.main, flags_parser=tensorboard.configure)
    except base_plugin.FlagsError as e:
        print("Error: %s" % e, file=sys.stderr)
        sys.exit(1)
Beispiel #3
0
def run_main():
    """Initializes flags and calls main()."""
    main_lib.global_init()

    path = os.path.join(os.path.dirname(__file__), "dev_webfiles.zip")
    tensorboard = program.TensorBoard(
        plugins=default.get_plugins(),
        assets_zip_provider=lambda: open(path, "rb"),
        subcommands=[uploader_subcommand.UploaderSubcommand()],
    )

    try:
        app.run(tensorboard.main, flags_parser=tensorboard.configure)
    except base_plugin.FlagsError as e:
        print("Error: %s" % e, file=sys.stderr)
        sys.exit(1)
Beispiel #4
0
def run_main():
    """Initializes flags and calls main()."""
    main_lib.global_init()

    path = os.path.join(os.path.dirname(inspect.getfile(sys._getframe(0))),
                        "webfiles.zip")

    if not os.path.exists(path):
        logger.warning("webfiles.zip static assets not found: %s", path)
        return None

    tensorboard = program.TensorBoard(
        lambda: open(path, "rb"),
        plugins=default.get_plugins(),
        subcommands=[uploader_subcommand.UploaderSubcommand()],
    )
    try:
        app.run(tensorboard.main, flags_parser=tensorboard.configure)
    except base_plugin.FlagsError as e:
        print("Error: %s" % e, file=sys.stderr)
        sys.exit(1)