Esempio n. 1
0
def test_multisource_performance():
    ts_targ = tangos.get_item("sim/ts1")
    sources = tangos.get_items(["sim/ts3/1", "sim/ts3/2", "sim/ts3/3"])
    with testing.SqlExecutionTracker() as track:
        halo_finding.MultiSourceMultiHopStrategy(sources, ts_targ).all()

    assert track.count_statements_containing("select halos.") == 0
Esempio n. 2
0
def test_reconstruction_optimized():
    # check that no temporary tables are created during reassembly of a histogram property
    ts2_h1 = db.get_halo("sim/ts2/1")
    hist_obj = ts2_h1.get_objects("dummy_histogram")[0]

    with testing.SqlExecutionTracker(db.core.get_default_engine()) as track:
        hist_obj.get_data_with_reassembly_options('sum')

    # print out any tracebacks for select haloproperties, for debug help
    for s in track.traceback_statements_containing("select haloproperties"):
        print ("traceback for select haloproperties:")
        print(s)

    # current algorithm constructs 2 temp tables for merger tree probe, plus one for final gathering of properties
    assert track.count_statements_containing("create temporary table") <= 3

    # joined load should prevent separate selects being emitted
    assert "select haloproperties" not in track
def test_redirection_cascade_efficiency():
    h = tangos.get_halo("sim/ts3/1")
    with testing.SqlExecutionTracker(db.core.get_default_engine()) as track:
        h.calculate_for_progenitors("my_BH('hole_spin').test_array")
    assert "select haloproperties" not in track # array should have been loaded as part of a big join