From bfd0af52bc6910c30186da65dc6eb0036fe45aad Mon Sep 17 00:00:00 2001 From: Andrew Tan Date: Fri, 5 Apr 2019 00:16:35 -0700 Subject: [PATCH] [tune] Add documentation to --output flag (#4518) ## What do these changes do? Add documentation for the `--output` flag for ls / lsx in the Tune CLI. ## Related issue number Closes #4511 ## Linter - [x] I've run `scripts/format.sh` to lint the changes in this PR. --- doc/source/tune-usage.rst | 14 ++++++++++---- python/ray/tune/commands.py | 15 ++++++--------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/doc/source/tune-usage.rst b/doc/source/tune-usage.rst index aa19dd103..7ef0d0f74 100644 --- a/doc/source/tune-usage.rst +++ b/doc/source/tune-usage.rst @@ -465,11 +465,11 @@ Tune CLI (Experimental) Here are a few examples of command line calls. -- ``tune list-trials``: List tabular information about trials within an experiment. Add the ``--sort`` flag to sort the output by specific columns. Add the ``--filter`` flag to filter the output in the format ``" "``. +- ``tune list-trials``: List tabular information about trials within an experiment. Empty columns will be dropped by default. Add the ``--sort`` flag to sort the output by specific columns. Add the ``--filter`` flag to filter the output in the format ``" "``. Add the ``--output`` flag to write the trial information to a specific file (CSV or Pickle). .. code-block:: bash - $ tune list-trials [EXPERIMENT_DIR] + $ tune list-trials [EXPERIMENT_DIR] --output note.csv +------------------+-----------------------+------------+ | trainable_name | experiment_tag | trial_id | @@ -481,6 +481,8 @@ Here are a few examples of command line calls. | MyTrainableClass | 4_height=90,width=69 | ae4e02fb | +------------------+-----------------------+------------+ Dropped columns: ['status', 'last_update_time'] + Please increase your terminal size to view remaining columns. + Output saved at: note.csv $ tune list-trials [EXPERIMENT_DIR] --filter "trial_id == 7b99a28a" @@ -490,12 +492,13 @@ Here are a few examples of command line calls. | MyTrainableClass | 3_height=54,width=21 | 7b99a28a | +------------------+-----------------------+------------+ Dropped columns: ['status', 'last_update_time'] + Please increase your terminal size to view remaining columns. -- ``tune list-experiments``: List tabular information about experiments within a project. Add the ``--sort`` flag to sort the output by specific columns. Add the ``--filter`` flag to filter the output in the format ``" "``. +- ``tune list-experiments``: List tabular information about experiments within a project. Empty columns will be dropped by default. Add the ``--sort`` flag to sort the output by specific columns. Add the ``--filter`` flag to filter the output in the format ``" "``. Add the ``--output`` flag to write the trial information to a specific file (CSV or Pickle). .. code-block:: bash - $ tune list-experiments [PROJECT_DIR] + $ tune list-experiments [PROJECT_DIR] --output note.csv +----------------------+----------------+------------------+---------------------+ | name | total_trials | running_trials | terminated_trials | @@ -505,6 +508,8 @@ Here are a few examples of command line calls. | hyperband_test | 1 | 0 | 1 | +----------------------+----------------+------------------+---------------------+ Dropped columns: ['error_trials', 'last_updated'] + Please increase your terminal size to view remaining columns. + Output saved at: note.csv $ tune list-experiments [PROJECT_DIR] --filter "total_trials <= 1" --sort name @@ -515,6 +520,7 @@ Here are a few examples of command line calls. | test | 1 | 0 | 0 | +----------------------+----------------+------------------+---------------------+ Dropped columns: ['error_trials', 'last_updated'] + Please increase your terminal size to view remaining columns. Further Questions or Issues? diff --git a/python/ray/tune/commands.py b/python/ray/tune/commands.py index 590a00adc..b55e9d967 100644 --- a/python/ray/tune/commands.py +++ b/python/ray/tune/commands.py @@ -194,16 +194,14 @@ def list_trials(experiment_path, print_format_output(checkpoints_df) if output: - experiment_path = os.path.expanduser(experiment_path) - output_path = os.path.join(experiment_path, output) file_extension = os.path.splitext(output)[1].lower() if file_extension in (".p", ".pkl", ".pickle"): - checkpoints_df.to_pickle(output_path) + checkpoints_df.to_pickle(output) elif file_extension == ".csv": - checkpoints_df.to_csv(output_path, index=False) + checkpoints_df.to_csv(output, index=False) else: raise ValueError("Unsupported filetype: {}".format(output)) - print("Output saved at:", output_path) + print("Output saved at:", output) def list_experiments(project_path, @@ -295,15 +293,14 @@ def list_experiments(project_path, print_format_output(info_df) if output: - output_path = os.path.join(base, output) file_extension = os.path.splitext(output)[1].lower() if file_extension in (".p", ".pkl", ".pickle"): - info_df.to_pickle(output_path) + info_df.to_pickle(output) elif file_extension == ".csv": - info_df.to_csv(output_path, index=False) + info_df.to_csv(output, index=False) else: raise ValueError("Unsupported filetype: {}".format(output)) - print("Output saved at:", output_path) + print("Output saved at:", output) def add_note(path, filename="note.txt"):