Files
ray/python/ray/tune/scripts.py
T
Sven 60d4d5e1aa Remove future imports (#6724)
* Remove all __future__ imports from RLlib.

* Remove (object) again from tf_run_builder.py::TFRunBuilder.

* Fix 2xLINT warnings.

* Fix broken appo_policy import (must be appo_tf_policy)

* Remove future imports from all other ray files (not just RLlib).

* Remove future imports from all other ray files (not just RLlib).

* Remove future import blocks that contain `unicode_literals` as well.
Revert appo_tf_policy.py to appo_policy.py (belongs to another PR).

* Add two empty lines before Schedule class.

* Put back __future__ imports into determine_tests_to_run.py. Fails otherwise on a py2/print related error.
2020-01-09 00:15:48 -08:00

113 lines
2.9 KiB
Python

import click
import ray.tune.commands as commands
@click.group()
def cli():
pass
@cli.command()
@click.argument("experiment_path", required=True, type=str)
@click.option(
"--sort", default=None, type=str, help="Select which column to sort on.")
@click.option(
"--output",
"-o",
default=None,
type=str,
help="Select file to output information to.")
@click.option(
"--filter",
"filter_op",
default=None,
type=str,
help="Select filter in the format '<column> <operator> <value>'.")
@click.option(
"--columns",
default=None,
type=str,
help="Select columns to be displayed.")
@click.option(
"--limit",
default=None,
type=int,
help="Select number of rows to display.")
@click.option(
"--desc", default=False, type=bool, help="Sort ascending vs. descending.")
def list_trials(experiment_path, sort, output, filter_op, columns, limit,
desc):
"""Lists trials in the directory subtree starting at the given path."""
if sort:
sort = sort.split(",")
if columns:
columns = columns.split(",")
commands.list_trials(experiment_path, sort, output, filter_op, columns,
limit, desc)
@cli.command()
@click.argument("project_path", required=True, type=str)
@click.option(
"--sort", default=None, type=str, help="Select which column to sort on.")
@click.option(
"--output",
"-o",
default=None,
type=str,
help="Select file to output information to.")
@click.option(
"--filter",
"filter_op",
default=None,
type=str,
help="Select filter in the format '<column> <operator> <value>'.")
@click.option(
"--columns",
default=None,
type=str,
help="Select columns to be displayed.")
@click.option(
"--limit",
default=None,
type=int,
help="Select number of rows to display.")
@click.option(
"--desc", default=False, type=bool, help="Sort ascending vs. descending.")
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)
@cli.command()
@click.argument("path", required=True, type=str)
@click.option(
"--filename",
default="note.txt",
type=str,
help="Specify filename for note.")
def add_note(path, filename):
"""Adds user notes as a text file at the given path."""
commands.add_note(path, filename)
cli.add_command(list_trials, name="ls")
cli.add_command(list_trials, name="list-trials")
cli.add_command(list_experiments, name="lsx")
cli.add_command(list_experiments, name="list-experiments")
cli.add_command(add_note, name="add-note")
def main():
return cli()
if __name__ == "__main__":
main()