def test_get_dependents(experiment): # more parameters, more complicated dependencies x = ParamSpecBase("x", "numeric") t = ParamSpecBase("t", "numeric") y = ParamSpecBase("y", "numeric") x_raw = ParamSpecBase("x_raw", "numeric") x_cooked = ParamSpecBase("x_cooked", "numeric") z = ParamSpecBase("z", "numeric") deps_param_tree = {y: (x, t), z: (x_cooked, )} inferred_param_tree = {x_cooked: (x_raw, )} interdeps = InterDependencies_(dependencies=deps_param_tree, inferences=inferred_param_tree) description = RunDescriber(interdeps=interdeps) (_, run_id, _) = mut_queries.create_run( experiment.conn, experiment.exp_id, name="testrun", guid=generate_guid(), description=description, ) deps = mut_queries._get_dependents(experiment.conn, run_id) expected_deps = [ mut_queries._get_layout_id(experiment.conn, 'y', run_id), mut_queries._get_layout_id(experiment.conn, 'z', run_id) ] assert deps == expected_deps
def test_get_dependents(experiment): x = ParamSpec('x', 'numeric') t = ParamSpec('t', 'numeric') y = ParamSpec('y', 'numeric', depends_on=['x', 't']) # Make a dataset (_, run_id, _) = mut_queries.create_run(experiment.conn, experiment.exp_id, name='testrun', guid=generate_guid(), parameters=[x, t, y]) deps = mut_queries._get_dependents(experiment.conn, run_id) layout_id = mut_queries._get_layout_id(experiment.conn, 'y', run_id) assert deps == [layout_id] # more parameters, more complicated dependencies x_raw = ParamSpec('x_raw', 'numeric') x_cooked = ParamSpec('x_cooked', 'numeric', inferred_from=['x_raw']) z = ParamSpec('z', 'numeric', depends_on=['x_cooked']) (_, run_id, _) = mut_queries.create_run(experiment.conn, experiment.exp_id, name='testrun', guid=generate_guid(), parameters=[x, t, x_raw, x_cooked, y, z]) deps = mut_queries._get_dependents(experiment.conn, run_id) expected_deps = [ mut_queries._get_layout_id(experiment.conn, 'y', run_id), mut_queries._get_layout_id(experiment.conn, 'z', run_id) ] assert deps == expected_deps
def test_get_dependents_simple(experiment, simple_run_describer): (_, run_id, _) = mut_queries.create_run( experiment.conn, experiment.exp_id, name="testrun", guid=generate_guid(), description=simple_run_describer, ) deps = mut_queries._get_dependents(experiment.conn, run_id) layout_id = mut_queries._get_layout_id(experiment.conn, "y", run_id) assert deps == [layout_id]