Skip to content

Commit

Permalink
List EVC tree once only when querying with name
Browse files Browse the repository at this point in the history
Why:

The children should not be listed multiple times. If they appear in the
EVC tree of some parent experiment then they should not be listed as a
root as well.

How:

Problem was that all experiments matching the name would be fetched and
printed with their tree. When name is specified, version queried should
be 1 by default unless specified by the user.
  • Loading branch information
bouthilx committed Aug 27, 2021
1 parent 5099fe9 commit bc0754c
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/orion/core/cli/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def main(args):

if args["name"]:
query["name"] = args["name"]
query["version"] = args.get("version", None) or 1

experiments = get_storage().fetch_experiments(query)

Expand Down
43 changes: 43 additions & 0 deletions tests/functional/commands/test_list_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,46 @@ def test_exp_family_branch_same_name(
└test_single_exp_child-v1
"""
)


def test_exp_family_branch_same_name_with_name_query(
three_experiments_branch_same_name, monkeypatch, capsys
):
"""Test that two experiments with the same name and different versions are correctly printed
when name is queried
"""
monkeypatch.chdir(os.path.dirname(os.path.abspath(__file__)))

orion.core.cli.main(["list", "--name", "test_single_exp"])

captured = capsys.readouterr().out

assert (
captured
== """\
test_single_exp-v1┐
└test_single_exp-v2┐
└test_single_exp_child-v1
"""
)


def test_exp_family_branch_same_name_with_name_version_query(
three_experiments_branch_same_name, monkeypatch, capsys
):
"""Test that two experiments with the same name and different versions are correctly printed
when name and version is queried
"""
monkeypatch.chdir(os.path.dirname(os.path.abspath(__file__)))

orion.core.cli.main(["list", "--name", "test_single_exp", "--version", "2"])

captured = capsys.readouterr().out

assert (
captured
== """\
test_single_exp-v2┐
└test_single_exp_child-v1
"""
)

0 comments on commit bc0754c

Please sign in to comment.