Exemplo n.º 1
0
def test_sync_wandb_run_and_tensorboard(runner, live_mock_server):
    with runner.isolated_filesystem():
        run_dir = os.path.join("wandb", "offline-run-20210216_154407-g9dvvkua")
        utils.fixture_copy("wandb")
        utils.fixture_copy(
            "events.out.tfevents.1585769947.cvp",
            os.path.join(run_dir, "events.out.tfevents.1585769947.cvp"),
        )

        result = runner.invoke(cli.sync, ["--sync-all"])
        print(result.output)
        print(traceback.print_tb(result.exc_info[2]))
        assert result.exit_code == 0
        ctx = live_mock_server.get_ctx()
        assert "mock_server_entity/test/runs/g9dvvkua ...done." in result.output
        assert (
            len(utils.first_filestream(ctx)["files"]["wandb-events.jsonl"]["content"])
            == 1
        )
        assert ctx["file_bytes"]["code/standalone_tests/code-toad.py"] > 0

        # Check we marked the run as synced
        result = runner.invoke(cli.sync, [run_dir])
        assert result.exit_code == 0
        assert (
            "WARNING Found .wandb file, not streaming tensorboard metrics"
            in result.output
        )
Exemplo n.º 2
0
def test_sync_tensorboard_big(runner, live_mock_server):
    with runner.isolated_filesystem():
        utils.fixture_copy("events.out.tfevents.1611911647.big-histos")
        result = runner.invoke(cli.sync, ["."])
        print(result.output)
        print(traceback.print_tb(result.exc_info[2]))
        assert result.exit_code == 0
        assert "Found 1 tfevent files" in result.output
        assert "exceeds max data limit" in result.output
        ctx = live_mock_server.get_ctx()
        print(ctx)
        assert (len(
            utils.first_filestream(ctx)["files"]["wandb-history.jsonl"]
            ["content"]) == 27)
Exemplo n.º 3
0
def test_sync_wandb_run(runner, live_mock_server):
    with runner.isolated_filesystem():
        utils.fixture_copy("wandb")

        result = runner.invoke(cli.sync, ["--sync-all"])
        print(result.output)
        print(traceback.print_tb(result.exc_info[2]))
        assert result.exit_code == 0
        ctx = live_mock_server.get_ctx()
        assert "mock_server_entity/test/runs/g9dvvkua ...done." in result.output
        assert (len(
            utils.first_filestream(ctx)["files"]["wandb-events.jsonl"]
            ["content"]) == 1)

        # Check we marked the run as synced
        result = runner.invoke(cli.sync, ["--sync-all"])
        assert result.exit_code == 0
        assert "wandb: ERROR Nothing to sync." in result.output
Exemplo n.º 4
0
def test_sync_tensorboard(runner, live_mock_server):
    with runner.isolated_filesystem():
        utils.fixture_copy("events.out.tfevents.1585769947.cvp")

        result = runner.invoke(cli.sync, ["."])
        print(result.output)
        print(traceback.print_tb(result.exc_info[2]))
        assert result.exit_code == 0
        assert "Found 1 tfevent files" in result.output
        ctx = live_mock_server.get_ctx()
        print(ctx)
        assert (
            len(utils.first_filestream(ctx)["files"]["wandb-history.jsonl"]["content"])
            == 17
        )

        # Check the no sync tensorboard flag
        result = runner.invoke(cli.sync, [".", "--no-sync-tensorboard"])
        assert result.output == "Skipping directory: {}\n".format(os.path.abspath("."))
        assert os.listdir(".") == ["events.out.tfevents.1585769947.cvp"]