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 )
def test_run_from_tensorboard(runner, mock_server, api): with runner.isolated_filesystem(): utils.fixture_copy("events.out.tfevents.1585769947.cvp") run_id = wandb.util.generate_id() api.sync_tensorboard(".", project="test", run_id=run_id) assert mock_server.ctx["graphql"][-1]["variables"] == { "entity": "mock_server_entity", "name": run_id, "project": "test", }
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(ctx["file_stream"][0]["files"]["wandb-history.jsonl"] ["content"]) == 27)
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(ctx["file_stream"][0]["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
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(ctx["file_stream"][0]["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"]