Пример #1
0
def test_run_tensorboard_binary_not_found():
    original_binary = p.TENSORBOARD_BINARY
    p.TENSORBOARD_BINARY = "/tmp/asdf__4567897"
    with py.raises(p.TensorboardNotFoundError) as ex:
        port = p.run_tensorboard("/tmp/logdir",
                                 tensorboard_args=["--address-in-use"])
    p.TENSORBOARD_BINARY = original_binary
Пример #2
0
def run_tensorboard(run_id, tflog_id):
    data = current_app.config["data"]
    # optimisticaly suppose the run exists...
    run = data.get_run(run_id)
    base_dir = Path(run["experiment"]["base_dir"])
    log_dir = Path(run["info"]["tensorflow"]["logdirs"][tflog_id])
    # TODO ugly!!!
    if log_dir.is_absolute():
        path_to_log_dir = log_dir
    else:
        path_to_log_dir = base_dir.joinpath(log_dir)

    port = int(proc.run_tensorboard(str(path_to_log_dir)))
    url_root = request.url_root
    url_parts = re.search("://([^:/]+)", url_root)
    redirect_to_address = url_parts.group(1)
    return redirect("http://%s:%d" % (redirect_to_address, port))
Пример #3
0
def test_run_tensorboard_timeout():
    """ Fails on Windows because of missing "poll" on stdout. """
    with py.raises(TimeoutError) as ex:
        port = p.run_tensorboard("/tmp/logdir",
                                 tensorboard_args=["--print-nothing"])
Пример #4
0
def test_run_tensorboard_address_in_use():
    with py.raises(p.UnexpectedOutputError) as ex:
        port = p.run_tensorboard("/tmp/logdir",
                                 tensorboard_args=["--address-in-use"])
Пример #5
0
def test_run_tensorboard_other_output():
    with py.raises(p.UnexpectedOutputError) as ex:
        port = p.run_tensorboard("/tmp/logdir",
                                 tensorboard_args=["--print-nonsense"])
Пример #6
0
def test_run_tensorboard():
    port = p.run_tensorboard("/tmp/logdir")
    assert port == "6006"