Example #1
0
def main(unused_argv=None):
    if FLAGS.debug:
        logging.set_verbosity(logging.DEBUG)
        logging.info('TensorBoard is in debug mode.')

    if not FLAGS.logdir:
        logging.error(
            'A logdir must be specified. Run `tensorboard --help` for '
            'details and examples.')
        return -1

    if FLAGS.debug:
        logging.info('Starting TensorBoard in directory %s', os.getcwd())

    path_to_run = ParseEventFilesFlag(FLAGS.logdir)
    multiplexer = event_multiplexer.AutoloadingMultiplexer(
        path_to_run=path_to_run,
        interval_secs=60,
        size_guidance=TENSORBOARD_SIZE_GUIDANCE)

    multiplexer.AutoUpdate(interval=30)

    factory = functools.partial(tensorboard_handler.TensorboardHandler,
                                multiplexer)
    try:
        server = ThreadedHTTPServer((FLAGS.host, FLAGS.port), factory)
    except socket.error:
        logging.error(
            'Tried to connect to port %d, but that address is in use.',
            FLAGS.port)
        return -2
    try:
        tag = resource_loader.load_resource('tensorboard/TAG').strip()
        logging.info('TensorBoard is tag: %s', tag)
    except IOError:
        logging.warning('Unable to read TensorBoard tag')
        tag = ''

    status_bar.SetupStatusBarInsideGoogle('TensorBoard %s' % tag, FLAGS.port)
    print('Starting TensorBoard %s on port %d' % (tag, FLAGS.port))
    print('(You can navigate to http://%s:%d)' % (FLAGS.host, FLAGS.port))
    server.serve_forever()
Example #2
0
def main(unused_argv=None):
    # Change current working directory to tensorflow/'s parent directory.
    server_root = os.path.join(os.path.dirname(__file__), os.pardir, os.pardir)
    os.chdir(server_root)

    if FLAGS.debug:
        logging.set_verbosity(logging.DEBUG)

    if not FLAGS.logdir:
        logging.error(
            'A logdir must be specified. Run `tensorboard --help` for '
            'details and examples.')
        return -1

    if FLAGS.debug:
        logging.info('Starting TensorBoard in directory %s', os.getcwd())

    path_to_run = ParseEventFilesFlag(FLAGS.logdir)
    multiplexer = event_multiplexer.AutoloadingMultiplexer(
        path_to_run=path_to_run,
        interval_secs=60,
        size_guidance=TENSORBOARD_SIZE_GUIDANCE)

    multiplexer.AutoUpdate(interval=30)

    factory = functools.partial(tensorboard_handler.TensorboardHandler,
                                multiplexer)
    try:
        server = ThreadedHTTPServer((FLAGS.host, FLAGS.port), factory)
    except socket.error:
        logging.error(
            'Tried to connect to port %d, but that address is in use.',
            FLAGS.port)
        return -2

    status_bar.SetupStatusBarInsideGoogle('TensorBoard', FLAGS.port)
    print('Starting TensorBoard on port %d' % FLAGS.port)
    print('(You can navigate to http://localhost:%d)' % FLAGS.port)
    server.serve_forever()