예제 #1
0
def test_lsx(start_ray, tmpdir):
    """This test captures output of list_experiments."""
    project_path = str(tmpdir)
    num_experiments = 3
    for i in range(num_experiments):
        experiment_name = "test_lsx{}".format(i)
        tune.run("__fake",
                 name=experiment_name,
                 stop={"training_iteration": 1},
                 num_samples=1,
                 local_dir=project_path)

    limit = 2
    with Capturing() as output:
        commands.list_experiments(project_path,
                                  info_keys=("total_trials", ),
                                  limit=limit)
    lines = output.captured
    assert "total_trials" in lines[1]
    assert lines[1].count("|") == 2
    assert len(lines) == 3 + limit + 1

    with Capturing() as output:
        commands.list_experiments(project_path,
                                  sort=["total_trials"],
                                  info_keys=("total_trials", ),
                                  filter_op="total_trials == 1")
    lines = output.captured
    assert sum("1" in line for line in lines) >= num_experiments
    assert len(lines) == 3 + num_experiments + 1
예제 #2
0
파일: test_commands.py 프로젝트: zhy52/ray
def test_lsx(start_ray, tmpdir):
    """This test captures output of list_experiments."""
    project_path = str(tmpdir)
    num_experiments = 3
    for i in range(num_experiments):
        experiment_name = "test_lsx{}".format(i)
        tune.run_experiments({
            experiment_name: {
                "run": "__fake",
                "stop": {
                    "training_iteration": 1
                },
                "num_samples": 1,
                "local_dir": project_path
            }
        })

    with Capturing() as output:
        commands.list_experiments(project_path, info_keys=("total_trials", ))
    lines = output.captured
    assert sum("1" in line for line in lines) >= num_experiments

    with Capturing() as output:
        commands.list_experiments(project_path,
                                  info_keys=("total_trials", ),
                                  filter_op="total_trials == 1")
    lines = output.captured
    assert sum("1" in line for line in lines) >= num_experiments
    assert len(lines) == 3 + num_experiments + 1
예제 #3
0
def list_experiments(project_path, sort, output, filter_op, columns, limit,
                     desc):
    """Lists experiments in the directory subtree."""
    if sort:
        sort = sort.split(",")
    if columns:
        columns = columns.split(",")
    commands.list_experiments(project_path, sort, output, filter_op, columns,
                              limit, desc)
예제 #4
0
def test_lsx(start_ray, capsys, tmpdir):
    """This test captures output of list_experiments."""
    project_path = str(tmpdir)
    num_experiments = 3
    for i in range(num_experiments):
        experiment_name = "test_lsx{}".format(i)
        with capsys.disabled():
            tune.run_experiments({
                experiment_name: {
                    "run": "__fake",
                    "stop": {
                        "training_iteration": 1
                    },
                    "num_samples": 1,
                    "local_dir": project_path
                }
            })

    commands.list_experiments(project_path, info_keys=("total_trials", ))
    captured = capsys.readouterr().out.strip()
    lines = captured.split("\n")
    assert sum("1" in line for line in lines) >= 3
예제 #5
0
def list_experiments(project_path, sort, output):
    """Lists experiments in the directory subtree."""
    commands.list_experiments(project_path, sort, output)
예제 #6
0
def list_experiments(project_path, sort, output):
    """Lists experiments in the directory subtree."""
    commands.list_experiments(project_path, sort, output)
예제 #7
0
파일: scripts.py 프로젝트: wanghuimu/ray
def list_experiments(project_path, sort, output, filter_op, columns):
    """Lists experiments in the directory subtree."""
    if columns:
        columns = columns.split(',')
    commands.list_experiments(project_path, sort, output, filter_op, columns)