diff --git a/rally/cli/commands/deployment.py b/rally/cli/commands/deployment.py index 40b2804405..981430891d 100644 --- a/rally/cli/commands/deployment.py +++ b/rally/cli/commands/deployment.py @@ -41,28 +41,28 @@ class DeploymentCommands(object): """Set of commands that allow you to manage deployments.""" @cliutils.args("--name", type=str, required=True, - help="A name of the deployment.") + help="Name of the deployment.") @cliutils.args("--fromenv", action="store_true", help="Read environment variables instead of config file.") @cliutils.args("--filename", type=str, required=False, metavar="", - help="A path to the configuration file of the " - "deployment.") + help="Path to the configuration file of the deployment.") @cliutils.args("--no-use", action="store_false", dest="do_use", - help="Don\'t set new deployment as default for" + help="Don't set new deployment as default for" " future operations.") @plugins.ensure_plugins_are_loaded def create(self, name, fromenv=False, filename=None, do_use=False): """Create new deployment. - This command will create new deployment record in rally database. - In case of ExistingCloud deployment engine it will use cloud, - represented in config. - In cases when cloud doesn't exists Rally will deploy new one - for you with Devstack or Fuel. For this purposes different deployment - engines are developed. + This command will create a new deployment record in rally + database. In the case of ExistingCloud deployment engine it + will use the cloud represented in the configuration. If the + cloud doesn't exist, Rally can deploy a new one for you with + Devstack or Fuel. Different deployment engines exist for these + cases. + + If you use the ExistingCloud deployment engine you can pass + a deployment config by environment variables with ``--fromenv``: - If you use ExistingCloud deployment engine you can pass deployment - config by environment variables: OS_USERNAME OS_PASSWORD OS_AUTH_URL @@ -72,18 +72,18 @@ class DeploymentCommands(object): OS_CACERT OS_INSECURE - All other deployment engines need more complex configuration data, so - it should be stored in configuration file. + All other deployment engines need more complex configuration + data, so it should be stored in a configuration file. - You can use physical servers, lxc containers, KVM virtual machines - or virtual machines in OpenStack for deploying the cloud in. - Except physical servers, Rally can create cluster nodes for you. - Interaction with virtualization software, OpenStack + You can use physical servers, LXC containers, KVM virtual + machines or virtual machines in OpenStack for deploying the + cloud. Except physical servers, Rally can create cluster nodes + for you. Interaction with virtualization software, OpenStack cloud or physical servers is provided by server providers. :param fromenv: boolean, read environment instead of config file - :param filename: a path to the configuration file - :param name: a name of the deployment + :param filename: path to the configuration file + :param name: name of the deployment """ if fromenv: @@ -112,32 +112,33 @@ class DeploymentCommands(object): @cliutils.args("--deployment", dest="deployment", type=str, metavar="", required=False, - help="UUID or name of a deployment.") + help="UUID or name of the deployment.") @envutils.with_default_deployment() @plugins.ensure_plugins_are_loaded def recreate(self, deployment=None): """Destroy and create an existing deployment. - Unlike 'deployment destroy' command deployment database record will - not be deleted, so deployment's UUID stay same. + Unlike 'deployment destroy', the deployment database record + will not be deleted, so the deployment UUID stays the same. - :param deployment: a UUID or name of the deployment + :param deployment: UUID or name of the deployment """ api.Deployment.recreate(deployment) @cliutils.args("--deployment", dest="deployment", type=str, metavar="", required=False, - help="UUID or name of a deployment.") + help="UUID or name of the deployment.") @envutils.with_default_deployment() @plugins.ensure_plugins_are_loaded def destroy(self, deployment=None): """Destroy existing deployment. - This will delete all containers, virtual machines, OpenStack instances - or Fuel clusters created during Rally deployment creation. Also it will - remove deployment record from Rally database. + This will delete all containers, virtual machines, OpenStack + instances or Fuel clusters created during Rally deployment + creation. Also it will remove the deployment record from the + Rally database. - :param deployment: a UUID or name of the deployment + :param deployment: UUID or name of the deployment """ api.Deployment.destroy(deployment) @@ -163,7 +164,7 @@ class DeploymentCommands(object): @cliutils.args("--deployment", dest="deployment", type=str, metavar="", required=False, - help="UUID or name of a deployment.") + help="UUID or name of the deployment.") @envutils.with_default_deployment() @cliutils.suppress_warnings def config(self, deployment=None): @@ -172,7 +173,7 @@ class DeploymentCommands(object): Output is the configuration of the deployment in a pretty-printed JSON format. - :param deployment: a UUID or name of the deployment + :param deployment: UUID or name of the deployment """ deploy = api.Deployment.get(deployment) result = deploy["config"] @@ -180,12 +181,12 @@ class DeploymentCommands(object): @cliutils.args("--deployment", dest="deployment", type=str, metavar="", required=False, - help="UUID or name of a deployment.") + help="UUID or name of the deployment.") @envutils.with_default_deployment() def show(self, deployment=None): """Show the credentials of the deployment. - :param deployment: a UUID or name of the deployment + :param deployment: UUID or name of the deployment """ headers = ["auth_url", "username", "password", "tenant_name", @@ -205,12 +206,12 @@ class DeploymentCommands(object): @cliutils.args("--deployment", dest="deployment", type=str, metavar="", required=False, - help="UUID or name of a deployment.") + help="UUID or name of the deployment.") @envutils.with_default_deployment() def check(self, deployment=None): """Check keystone authentication and list all available services. - :param deployment: a UUID or name of the deployment + :param deployment: UUID or name of the deployment """ headers = ["services", "type", "status"] table_rows = [] @@ -275,7 +276,7 @@ class DeploymentCommands(object): def use(self, deployment): """Set active deployment. - :param deployment: UUID or name of a deployment + :param deployment: UUID or name of the deployment """ try: deployment = api.Deployment.get(deployment) diff --git a/rally/cli/commands/plugin.py b/rally/cli/commands/plugin.py index 8275683baa..e476419292 100644 --- a/rally/cli/commands/plugin.py +++ b/rally/cli/commands/plugin.py @@ -24,7 +24,7 @@ from rally import plugins class PluginCommands(object): - """Command allows to manage Rally plugins.""" + """Set of commands that allow you to manage Rally plugins.""" @staticmethod def _print_plugins_list(plugin_list): @@ -41,7 +41,7 @@ class PluginCommands(object): help="Plugin namespace.") @plugins.ensure_plugins_are_loaded def show(self, name, namespace=None): - """Show detailed information about Rally plugin.""" + """Show detailed information about a Rally plugin.""" name_lw = name.lower() all_plugins = plugin.Plugin.get_all(namespace=namespace) found = [p for p in all_plugins if name_lw in p.get_name().lower()] @@ -78,9 +78,10 @@ class PluginCommands(object): self._print_plugins_list(found) @cliutils.args("--name", dest="name", type=str, - help="List only plugins that match passed name.") - @cliutils.args("--namespace", dest="namespace", type=str, - help="List only plugins that are in specified namespace") + help="List only plugins that match the given name.") + @cliutils.args( + "--namespace", dest="namespace", type=str, + help="List only plugins that are in the specified namespace.") @plugins.ensure_plugins_are_loaded def list(self, name=None, namespace=None): """List all Rally plugins that match name and namespace.""" diff --git a/rally/cli/commands/task.py b/rally/cli/commands/task.py index dd5cf52366..783307e07c 100644 --- a/rally/cli/commands/task.py +++ b/rally/cli/commands/task.py @@ -46,9 +46,8 @@ class FailedToLoadTask(exceptions.RallyException): class TaskCommands(object): - """Task management. + """Set of commands that allow you to manage benchmarking tasks and results. - Set of commands that allow you to manage benchmarking tasks and results. """ def _load_task(self, task_file, task_args=None, task_args_file=None): @@ -142,14 +141,14 @@ class TaskCommands(object): metavar="", required=False, help="UUID or name of a deployment.") @cliutils.args("--task", "--filename", metavar="", - help="Path to the file with full configuration of task") + help="Path to the input task file.") @cliutils.args("--task-args", metavar="", dest="task_args", - help="Input task args (dict in json). These args are used " - "to render input task that is jinja2 template.") + help="Input task args (JSON dict). These args are used " + "to render the Jinja2 template in the input task.") @cliutils.args("--task-args-file", metavar="", dest="task_args_file", help="Path to the file with input task args (dict in " - "json/yaml). These args are used to render input " - "task that is jinja2 template.") + "JSON/YAML). These args are used " + "to render the Jinja2 template in the input task.") @envutils.with_default_deployment(cli_arg_name="deployment") @plugins.ensure_plugins_are_loaded def validate(self, task, deployment=None, task_args=None, @@ -159,13 +158,19 @@ class TaskCommands(object): This will check that task configuration file has valid syntax and all required options of scenarios, contexts, SLA and runners are set. - :param task: a file with yaml/json task - :param task_args: Input task args (dict in json/yaml). These args are - used to render input task that is jinja2 template. - :param task_args_file: File with input task args (dict in json/yaml). - These args are used to render input task that - is jinja2 template. - :param deployment: UUID or name of a deployment + If both task_args and task_args_file are specified, they will + be merged. task_args has a higher priority so it will override + values from task_args_file. + + :param task: Path to the input task file. + :param task_args: Input task args (JSON dict). These args are + used to render the Jinja2 template in the + input task. + :param task_args_file: Path to the file with input task args + (dict in JSON/YAML). These args are + used to render the Jinja2 template in + the input task. + :param deployment: UUID or name of the deployment """ try: self._load_and_validate_task(task, task_args, task_args_file, @@ -181,32 +186,38 @@ class TaskCommands(object): @cliutils.args("--task", "--filename", metavar="", help="Path to the input task file") @cliutils.args("--task-args", dest="task_args", metavar="", - help="Input task args (dict in json). These args are used " - "to render input task that is jinja2 template.") + help="Input task args (JSON dict). These args are used " + "to render the Jinja2 template in the input task.") @cliutils.args("--task-args-file", dest="task_args_file", metavar="", help="Path to the file with input task args (dict in " - "json/yaml). These args are used to render input " - "task that is jinja2 template.") + "JSON/YAML). These args are used " + "to render the Jinja2 template in the input task.") @cliutils.args("--tag", help="Tag for this task") @cliutils.args("--no-use", action="store_false", dest="do_use", - help="Don't set new task as default for future operations") + help="Don't set new task as default for future operations.") @cliutils.args("--abort-on-sla-failure", action="store_true", dest="abort_on_sla_failure", help="Abort the execution of a benchmark scenario when" - "any SLA check for it fails") + "any SLA check for it fails.") @envutils.with_default_deployment(cli_arg_name="deployment") @plugins.ensure_plugins_are_loaded def start(self, task, deployment=None, task_args=None, task_args_file=None, tag=None, do_use=False, abort_on_sla_failure=False): """Start benchmark task. - :param task: a file with yaml/json task - :param task_args: Input task args (dict in json/yaml). These args are - used to render input task that is jinja2 template. - :param task_args_file: File with input task args (dict in json/yaml). - These args are used to render input task that - is jinja2 template. - :param deployment: UUID or name of a deployment + If both task_args and task_args_file are specified, they will + be merged. task_args has a higher priority so it will override + values from task_args_file. + + :param task: Path to the input task file. + :param task_args: Input task args (JSON dict). These args are + used to render the Jinja2 template in the + input task. + :param task_args_file: Path to the file with input task args + (dict in JSON/YAML). These args are + used to render the Jinja2 template in + the input task. + :param deployment: UUID or name of the deployment :param tag: optional tag for this task :param do_use: if True, the new task will be stored as the default one for future operations @@ -242,22 +253,23 @@ class TaskCommands(object): print(e, file=sys.stderr) return(1) - @cliutils.args("--uuid", type=str, dest="task_id", help="UUID of task") + @cliutils.args("--uuid", type=str, dest="task_id", help="UUID of task.") @envutils.with_default_task_id - @cliutils.args("--soft", action="store_true", - help="Abort task after current scenario full execution") + @cliutils.args( + "--soft", action="store_true", + help="Abort task after current scenario finishes execution.") def abort(self, task_id=None, soft=False): - """Abort started benchmarking task. + """Abort a running benchmarking task. :param task_id: Task uuid :param soft: if set to True, task should be aborted after execution of current scenario """ if soft: - print("INFO: please be informed that soft abort wont stop " - "current running scenario, it will prevent to start " - "new ones, so if you are running task with only one " - "scenario - soft abort will not help at all.") + print("INFO: please be informed that soft abort won't stop " + "a running scenario, but will prevent new ones from " + "starting. If you are running task with only one " + "scenario, soft abort will not help at all.") api.Task.abort(task_id, soft, async=False) @@ -266,7 +278,7 @@ class TaskCommands(object): @cliutils.args("--uuid", type=str, dest="task_id", help="UUID of task") @envutils.with_default_task_id def status(self, task_id=None): - """Display current status of task. + """Display the current status of a task. :param task_id: Task uuid Returns current status of task @@ -277,11 +289,11 @@ class TaskCommands(object): % {"task_id": task_id, "status": task["status"]}) @cliutils.args("--uuid", type=str, dest="task_id", - help=("uuid of task, if --uuid is \"last\" results of most " - "recently created task will be displayed.")) + help=("UUID of task. If --uuid is \"last\" the results of " + " the most recently created task will be displayed.")) @cliutils.args("--iterations-data", dest="iterations_data", action="store_true", - help="print detailed results for each iteration") + help="Print detailed results for each iteration.") @envutils.with_default_task_id def detailed(self, task_id=None, iterations_data=False): """Display results table. @@ -493,7 +505,7 @@ class TaskCommands(object): result["data"]["full_duration"]) _print_hints(task) - @cliutils.args("--uuid", type=str, dest="task_id", help="uuid of task") + @cliutils.args("--uuid", type=str, dest="task_id", help="UUID of task.") @envutils.with_default_task_id @cliutils.suppress_warnings def results(self, task_id=None): @@ -527,15 +539,16 @@ class TaskCommands(object): help="List tasks with specified status." " Available statuses: %s" % ", ".join(consts.TaskStatus)) @cliutils.args("--uuids-only", action="store_true", - dest="uuids_only", help="List task UUIDs only") + dest="uuids_only", help="List task UUIDs only.") @envutils.with_default_deployment(cli_arg_name="deployment") def list(self, deployment=None, all_deployments=False, status=None, uuids_only=False): """List tasks, started and finished. - Displayed tasks could be filtered by status or deployment. - By default 'rally task list' will display tasks from active deployment - without filtering by status. + Displayed tasks can be filtered by status or deployment. By + default 'rally task list' will display tasks from the active + deployment without filtering by status. + :param deployment: UUID or name of deployment :param status: task status to filter by. Available task statuses are in rally.consts.TaskStatus @@ -583,12 +596,12 @@ class TaskCommands(object): "\trally task start")) @cliutils.args("--tasks", dest="tasks", nargs="+", - help="uuids of tasks or json files with task results") + help="UUIDs of tasks, or JSON files with task results") @cliutils.args("--out", metavar="", type=str, dest="out", required=False, help="Path to output file.") @cliutils.args("--open", dest="open_it", action="store_true", - help="Open it in browser.") + help="Open the output in a browser.") @cliutils.args("--html", dest="out_format", action="store_const", const="html", help="Generate the report in HTML.") @@ -596,7 +609,7 @@ class TaskCommands(object): action="store_const", const="html_static", help=("Generate the report in HTML with embedded " "JS and CSS, so it will not depend on " - "the Internet availability.")) + "Internet availability.")) @cliutils.args("--junit", dest="out_format", action="store_const", const="junit", help="Generate the report in the JUnit format.") @@ -689,7 +702,7 @@ class TaskCommands(object): @cliutils.args("--force", action="store_true", help="force delete") @cliutils.args("--uuid", type=str, dest="task_id", nargs="*", metavar="TASK_ID", - help="uuid of task or a list of task uuids") + help="UUID of task or a list of task UUIDs.") @envutils.with_default_task_id def delete(self, task_id=None, force=False): """Delete task and its results. @@ -713,10 +726,10 @@ class TaskCommands(object): else: _delete_single_task(task_id, force) - @cliutils.args("--uuid", type=str, dest="task_id", help="uuid of task") + @cliutils.args("--uuid", type=str, dest="task_id", help="UUID of task.") @cliutils.args("--json", dest="tojson", action="store_true", - help="output in json format") + help="Output in JSON format.") @envutils.with_default_task_id def sla_check(self, task_id=None, tojson=False): """Display SLA check results table. diff --git a/rally/cli/commands/verify.py b/rally/cli/commands/verify.py index 528ae2435f..235aea107c 100644 --- a/rally/cli/commands/verify.py +++ b/rally/cli/commands/verify.py @@ -51,23 +51,23 @@ class VerifyCommands(object): help="Name of a Tempest test set. " "Available sets are %s" % ", ".join(AVAILABLE_SETS)) @cliutils.args("--regex", dest="regex", type=str, required=False, - help="Regular expression of test") + help="Test name regular expression") @cliutils.args("--tests-file", metavar="", dest="tests_file", type=str, required=False, help="Path to a file with a list of Tempest tests") @cliutils.args("--tempest-config", dest="tempest_config", type=str, required=False, metavar="", - help="User specified Tempest config file location") + help="User-specified Tempest config file location") @cliutils.args("--xfails-file", dest="xfails_file", type=str, required=False, metavar="", - help="Path to a file in YAML format with a list of Tempest " + help="Path to a YAML file with a list of Tempest " "tests that are expected to fail") @cliutils.args("--no-use", action="store_false", dest="do_use", - help="Don't set new task as default for future operations") + help="Don't set the task as default for future operations") @cliutils.args("--system-wide", dest="system_wide", help="Don't create a virtual env when installing Tempest; " "use the local env instead of the Tempest virtual env " - "when running the tests. Take notice that all Tempest " + "when running the tests. Note that all Tempest " "requirements have to be already installed in " "the local env!", required=False, action="store_true") @@ -172,7 +172,7 @@ class VerifyCommands(object): self.use(verification["uuid"]) def list(self): - """Display verifications table.""" + """List verification runs.""" fields = ["UUID", "Deployment UUID", "Set name", "Tests", "Failures", "Created at", "Duration", "Status"] @@ -189,14 +189,14 @@ class VerifyCommands(object): "To start verification use:\nrally verify start")) @cliutils.args("--uuid", type=str, dest="verification", - help="UUID of a verification") + help="UUID of a verification.") @cliutils.args("--html", action="store_true", dest="output_html", - help="Display results in HTML format") + help="Display results in HTML format.") @cliutils.args("--json", action="store_true", dest="output_json", - help="Display results in JSON format") + help="Display results in JSON format.") @cliutils.args("--output-file", type=str, required=False, dest="output_file", metavar="", - help="Path to a file to save results") + help="Path to a file to save results to.") @envutils.with_default_verification_id @cliutils.suppress_warnings def results(self, verification=None, output_file=None, @@ -234,7 +234,7 @@ class VerifyCommands(object): required=False, help="UUID of a verification") @cliutils.args("--sort-by", metavar="", dest="sort_by", type=str, - required=False, + required=False, choices=("name", "duration"), help="Sort results by 'name' or 'duration'") @cliutils.args("--detailed", dest="detailed", action="store_true", required=False, @@ -247,12 +247,6 @@ class VerifyCommands(object): :param sort_by: Sort results by 'name' or 'duration' :param detailed: Display detailed errors of failed tests """ - try: - sortby_index = ("name", "duration").index(sort_by) - except ValueError: - print(_("Verification results can't be sorted by '%s'.") % sort_by) - return 1 - try: verification = api.Verification.get(verification) tests = verification.get_results() @@ -270,6 +264,7 @@ class VerifyCommands(object): results = tests["test_cases"] values = [utils.Struct(**results[test_name]) for test_name in results] + sortby_index = ("name", "duration").index(sort_by) cliutils.print_list(values, fields, sortby_index=sortby_index) if detailed: @@ -285,9 +280,9 @@ class VerifyCommands(object): print(formatted_test) @cliutils.args("--uuid", dest="verification", type=str, - required=False, help="UUID of a verification") - @cliutils.args("--sort-by", dest="sort_by", type=str, required=False, - help="Sort results by 'name' or 'duration'") + required=False, help="UUID of a verification.") + @cliutils.args("--sort-by", dest="sort_by", choices=("name", "duration"), + required=False, help="Sort results by 'name' or 'duration'") @envutils.with_default_verification_id def detailed(self, verification=None, sort_by="name"): """Display results table of a verification with detailed errors. @@ -378,16 +373,16 @@ class VerifyCommands(object): help="UUID or name of a deployment.") @cliutils.args("--tempest-config", dest="tempest_config", type=str, required=False, metavar="", - help="User specified Tempest config file location") + help="User-specified Tempest config file location") @cliutils.args("--override", dest="override", help="Override existing Tempest config file", required=False, action="store_true") @envutils.with_default_deployment(cli_arg_name="deployment") def genconfig(self, deployment=None, tempest_config=None, override=False): - """Generate configuration file of Tempest. + """Generate Tempest configuration file. :param deployment: UUID or name of a deployment - :param tempest_config: User specified Tempest config file location + :param tempest_config: User-specified Tempest config file location :param override: Whether or not to override existing Tempest config file """ @@ -400,7 +395,7 @@ class VerifyCommands(object): @cliutils.args("--source", type=str, dest="source", required=False, help="Path/URL to repo to clone Tempest from") @cliutils.args("--system-wide", dest="system_wide", - help="Don't create a virtual env for Tempest. Take notice " + help="Don't create a virtual env for Tempest. Note " "that all Tempest requirements have to be already " "installed in the local env!", required=False, action="store_true") @@ -422,7 +417,7 @@ class VerifyCommands(object): help="UUID or name of a deployment.") @envutils.with_default_deployment(cli_arg_name="deployment") def uninstall(self, deployment=None): - """Remove deployment's local Tempest installation. + """Remove the deployment's local Tempest installation. :param deployment: UUID or name of a deployment """ @@ -437,7 +432,7 @@ class VerifyCommands(object): @cliutils.args("--source", type=str, dest="source", required=False, help="Path/URL to repo to clone Tempest from") @cliutils.args("--system-wide", dest="system_wide", - help="Don't create a virtual env for Tempest. Take notice " + help="Don't create a virtual env for Tempest. Note " "that all Tempest requirements have to be already " "installed in the local env!", required=False, action="store_true")