Esempio n. 1
0
def test_fetch_files_function(tmpdir):
    # Setup and run three experiments
    root = tmpdir.strpath
    run_test_experiment(exp_name='experiment 1 alpha',
                        exp_id='1234',
                        root_dir=root)
    run_test_experiment(exp_name='experiment 2 beta',
                        exp_id='5678',
                        root_dir=root)
    run_test_experiment(exp_name='experiment 3 alpha beta',
                        exp_id='9990',
                        root_dir=root)

    tinydb_reader = TinyDbReader(root)

    res = tinydb_reader.fetch_files(indices=0)
    assert len(res) == 1
    assert list(res[0]['artifacts'].keys()) == ['about']
    assert isinstance(res[0]['artifacts']['about'], io.BufferedReader)
    assert res[0]['date'] == datetime.datetime(1999, 5, 4, 3, 2, 1)
    assert res[0]['exp_id'] == '1234'
    assert res[0]['exp_name'] == 'experiment 1 alpha'
    assert list(res[0]['resources'].keys()) == ['sacred/__init__.py']
    assert isinstance(res[0]['resources']['sacred/__init__.py'],
                      io.BufferedReader)
    assert list(res[0]['sources'].keys()) == ['setup.py']
    assert isinstance(res[0]['sources']['setup.py'], io.BufferedReader)
Esempio n. 2
0
def test_fetch_files_function(tmpdir):
    # Setup and run three experiments
    root = tmpdir.strpath
    run_test_experiment(exp_name="experiment 1 alpha",
                        exp_id="1234",
                        root_dir=root)
    run_test_experiment(exp_name="experiment 2 beta",
                        exp_id="5678",
                        root_dir=root)
    run_test_experiment(exp_name="experiment 3 alpha beta",
                        exp_id="9990",
                        root_dir=root)

    tinydb_reader = TinyDbReader(root)

    res = tinydb_reader.fetch_files(indices=0)
    assert len(res) == 1
    assert list(res[0]["artifacts"].keys()) == ["about"]
    assert isinstance(res[0]["artifacts"]["about"], io.BufferedReader)
    assert res[0]["date"] == datetime.datetime(1999, 5, 4, 3, 2, 1)
    assert res[0]["exp_id"] == "1234"
    assert res[0]["exp_name"] == "experiment 1 alpha"
    assert list(res[0]["resources"].keys()) == ["sacred/__init__.py"]
    assert isinstance(res[0]["resources"]["sacred/__init__.py"],
                      io.BufferedReader)
    assert list(res[0]["sources"].keys()) == ["setup.py"]
    assert isinstance(res[0]["sources"]["setup.py"], io.BufferedReader)
Esempio n. 3
0
def test_fetch_files_function(tmpdir):
    # Setup and run three experiments
    root = tmpdir.strpath
    run_test_experiment(exp_name='experiment 1 alpha',
                        exp_id='1234', root_dir=root)
    run_test_experiment(exp_name='experiment 2 beta',
                        exp_id='5678', root_dir=root)
    run_test_experiment(exp_name='experiment 3 alpha beta',
                        exp_id='9990', root_dir=root)

    tinydb_reader = TinyDbReader(root)

    res = tinydb_reader.fetch_files(indices=0)
    assert len(res) == 1
    assert list(res[0]['artifacts'].keys()) == ['about']
    assert isinstance(res[0]['artifacts']['about'], io.BufferedReader)
    assert res[0]['date'] == datetime.datetime(1999, 5, 4, 3, 2, 1)
    assert res[0]['exp_id'] == '1234'
    assert res[0]['exp_name'] == 'experiment 1 alpha'
    assert list(res[0]['resources'].keys()) == ['sacred/__init__.py']
    assert isinstance(res[0]['resources']['sacred/__init__.py'], io.BufferedReader)
    assert list(res[0]['sources'].keys()) == ['setup.py']
    assert isinstance(res[0]['sources']['setup.py'], io.BufferedReader)