Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When running rally with no options, print help and exit. #1500

Merged
merged 3 commits into from
May 26, 2022

Conversation

j-bennet
Copy link
Contributor

Fixes #1459.

When running esrally with no options, print help and exit.

Another option would be to specify required=True in add_subparsers, to enforce user choosing a subparser. But in that case, the message is less helpful:

usage: esrally [-h] [--version] [--quiet] [--offline] {race,list,info,create-track,generate,compare,download,install,start,stop} ...
esrally: error: the following arguments are required: subcommand

so I opted for printing help instead:

> esrally
usage: esrally [-h] [--version] [--quiet] [--offline] {race,list,info,create-track,generate,compare,download,install,start,stop} ...

    ____        ____
   / __ \____ _/ / /_  __
  / /_/ / __ `/ / / / / /
 / _, _/ /_/ / / / /_/ /
/_/ |_|\__,_/_/_/\__, /
                /____/

 You Know, for Benchmarking Elasticsearch.

optional arguments:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
  --quiet               Suppress as much as output as possible (default: false).
  --offline             Assume that Rally has no connection to the Internet (default: false).

subcommands:
  {race,list,info,create-track,generate,compare,download,install,start,stop}
    race                Run a benchmark
    list                List configuration options
    info                Show info about a track
    create-track        Create a Rally track from existing data
    generate            Generate artifacts
    compare             Compare two races
    download            Downloads an artifact
    install             Installs an Elasticsearch node locally
    start               Starts an Elasticsearch node locally
    stop                Stops an Elasticsearch node locally

Find out more about Rally at https://esrally.readthedocs.io/en/latest/

Copy link
Member

@pquentin pquentin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! This is a small addition that will really help new users. Left one nit.

@j-bennet j-bennet requested a review from pquentin May 25, 2022 16:39
Copy link
Member

@pquentin pquentin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! LGTM.

Normally I'd ask you to add a test so that this does not breaks again in the future but that's not really practical with argparse and switching to click/typer isn't trivial.

@j-bennet
Copy link
Contributor Author

@pquentin

Normally I'd ask you to add a test so that this does not breaks again in the future but that's not really practical with argparse and switching to click/typer isn't trivial.

I saw there are integration tests. I added one - perhaps better than nothing?

@j-bennet j-bennet merged commit 56e33c2 into elastic:master May 26, 2022
@j-bennet j-bennet deleted the j-bennet/1459-run-with-no-params branch May 26, 2022 18:26
@pquentin pquentin added the bug Something's wrong label Jun 23, 2022
@pquentin pquentin added this to the 2.5.0 milestone Jun 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something's wrong
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Running esrally without any arguments crashes
2 participants