Beispiel #1
0
def run_test_experiment(exp_name, exp_id, root_dir):

    T2 = datetime.datetime(1999, 5, 5, 5, 5, 5, 5)
    T3 = datetime.datetime(1999, 5, 5, 6, 6, 6, 6)

    run_date = sample_run()
    run_date['ex_info']['name'] = exp_name
    run_date['_id'] = exp_id

    # Create
    tinydb_obs = TinyDbObserver.create(path=root_dir)

    # Start exp 1
    tinydb_obs.started_event(**run_date)

    # Heartbeat
    info = {'my_info': [1, 2, 3], 'nr': 7}
    outp = 'some output'
    tinydb_obs.heartbeat_event(info=info, captured_out=outp, beat_time=T2)
    # Add Artifact
    filename = "sacred/__about__.py"
    name = 'about'
    tinydb_obs.artifact_event(name, filename)

    # Add Resource
    filename = "sacred/__init__.py"
    tinydb_obs.resource_event(filename)

    # Complete
    tinydb_obs.completed_event(stop_time=T3, result=42)

    return tinydb_obs
Beispiel #2
0
def run_test_experiment(exp_name, exp_id, root_dir):

    T2 = datetime.datetime(1999, 5, 5, 5, 5, 5, 5)
    T3 = datetime.datetime(1999, 5, 5, 6, 6, 6, 6)

    run_date = sample_run()
    run_date['ex_info']['name'] = exp_name
    run_date['_id'] = exp_id

    # Create
    tinydb_obs = TinyDbObserver.create(path=root_dir)

    # Start exp 1
    tinydb_obs.started_event(**run_date)

    # Heartbeat
    info = {'my_info': [1, 2, 3], 'nr': 7}
    outp = 'some output'
    tinydb_obs.heartbeat_event(info=info, captured_out=outp, beat_time=T2,
                               result=7)
    # Add Artifact
    filename = "sacred/__about__.py"
    name = 'about'
    tinydb_obs.artifact_event(name, filename)

    # Add Resource
    filename = "sacred/__init__.py"
    tinydb_obs.resource_event(filename)

    # Complete
    tinydb_obs.completed_event(stop_time=T3, result=42)

    return tinydb_obs
Beispiel #3
0
def test_tinydb_observer_creates_missing_directories(tmpdir):
    tinydb_obs = TinyDbObserver.create(path=os.path.join(tmpdir.strpath, 'foo'))
    assert tinydb_obs.root == os.path.join(tmpdir.strpath, 'foo')
Beispiel #4
0
def tinydb_obs(tmpdir):
    return TinyDbObserver.create(path=tmpdir.strpath)
Beispiel #5
0
def test_tinydb_observer_creates_missing_directories(tmpdir):
    tinydb_obs = TinyDbObserver.create(path=os.path.join(tmpdir.strpath, 'foo'))
    assert tinydb_obs.root == os.path.join(tmpdir.strpath, 'foo')
Beispiel #6
0
def tinydb_obs(tmpdir):
    return TinyDbObserver.create(path=tmpdir.strpath)