Skip to content

Commit

Permalink
rename 'generate' -> 'create'
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmitterdorfer committed Apr 27, 2020
1 parent 3be0024 commit 1745eb4
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 29 deletions.
10 changes: 5 additions & 5 deletions docs/adding_tracks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ Definition

A track describes one or more benchmarking scenarios. Its structure is described in detail in the :doc:`track reference </track>`.

.. _add_track_generate_track:
.. _add_track_create_track:

Generating a track from data in an existing cluster
---------------------------------------------------
Creating a track from data in an existing cluster
-------------------------------------------------

If you already have a cluster with data in it you can use the ``generate-track`` subcommand of Rally to create a basic Rally track. To create a Rally track with data from the indices ``products`` and ``companies`` that are hosted by a locally running Elasticsearch cluster, issue the following command::
If you already have a cluster with data in it you can use the ``create-track`` subcommand of Rally to create a basic Rally track. To create a Rally track with data from the indices ``products`` and ``companies`` that are hosted by a locally running Elasticsearch cluster, issue the following command::

esrally --track=acme --target-hosts=127.0.0.1:9200 --indices="products,companies" --output-path=~/tracks
esrally create-track --track=acme --target-hosts=127.0.0.1:9200 --indices="products,companies" --output-path=~/tracks

.. note::
If the cluster requires authentication specify credentials via ``--client-options`` as described in the :ref:`command line reference <clr_client_options>`.
Expand Down
14 changes: 7 additions & 7 deletions docs/command_line_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ This subcommand is needed for :doc:`tournament mode </tournament>` and its usage

This subcommand is needed to :doc:`configure </configuration>` Rally. It is implicitly chosen if you start Rally for the first time but you can rerun this command at any time.

``generate-track``
~~~~~~~~~~~~~~~~~~
``create-track``
~~~~~~~~~~~~~~~~

This subcommand generates a basic track from data in an existing cluster. See the :ref:`track tutorial <add_track_generate_track>` for a complete walkthrough.
This subcommand creates a basic track from data in an existing cluster. See the :ref:`track tutorial <add_track_create_track>` for a complete walkthrough.

``download``
~~~~~~~~~~~~~
Expand Down Expand Up @@ -797,21 +797,21 @@ This will help you recognize a specific race when running ``esrally compare``.
``indices``
~~~~~~~~~~~

A comma-separated list of index patterns to target when generating a track with the ``generate-track`` subcommand.
A comma-separated list of index patterns to target when generating a track with the ``create-track`` subcommand.

**Examples**

Target a single index::

esrally generate-track --track=acme --indices="products" --target-hosts=127.0.0.1:9200 --output-path=~/tracks
esrally create-track --track=acme --indices="products" --target-hosts=127.0.0.1:9200 --output-path=~/tracks

Target multiple indices::

esrally generate-track --track=acme --indices="products,companies" --target-hosts=127.0.0.1:9200 --output-path=~/tracks
esrally create-track --track=acme --indices="products,companies" --target-hosts=127.0.0.1:9200 --output-path=~/tracks

Use index patterns::

esrally generate-track --track=my-logs --indices="logs-*" --target-hosts=127.0.0.1:9200 --output-path=~/tracks
esrally create-track --track=my-logs --indices="logs-*" --target-hosts=127.0.0.1:9200 --output-path=~/tracks


.. _command_line_reference_advanced_topics:
Expand Down
20 changes: 10 additions & 10 deletions esrally/rally.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,26 +124,26 @@ def runtime_jdk(v):
"--exclude-tasks",
help="Defines a comma-separated list of tasks not to run. By default all tasks of a challenge are run.")

generate_track_parser = subparsers.add_parser("generate-track", help="Generate a Rally track from existing data")
generate_track_parser.add_argument(
create_track_parser = subparsers.add_parser("create-track", help="Create a Rally track from existing data")
create_track_parser.add_argument(
"--track",
required=True,
help="Name of the generated track")
generate_track_parser.add_argument(
create_track_parser.add_argument(
"--indices",
type=non_empty_list,
required=True,
help="Comma-separated list of indices to include in the track")
generate_track_parser.add_argument(
create_track_parser.add_argument(
"--target-hosts",
default="",
required=True,
help="Comma-separated list of host:port pairs which should be targeted")
generate_track_parser.add_argument(
create_track_parser.add_argument(
"--client-options",
default=opts.ClientOptions.DEFAULT_CLIENT_OPTIONS,
help=f"Comma-separated list of client options to use. (default: {opts.ClientOptions.DEFAULT_CLIENT_OPTIONS})")
generate_track_parser.add_argument(
create_track_parser.add_argument(
"--output-path",
default=os.path.join(os.getcwd(), "tracks"),
help="Track output directory (default: tracks/)")
Expand Down Expand Up @@ -571,7 +571,7 @@ def runtime_jdk(v):
default=False)

for p in [parser, config_parser, list_parser, race_parser, compare_parser, download_parser, install_parser,
start_parser, stop_parser, info_parser, generate_parser, generate_track_parser, async_race_parser]:
start_parser, stop_parser, info_parser, generate_parser, create_track_parser, async_race_parser]:
# This option is needed to support a separate configuration for the integration tests on the same machine
p.add_argument(
"--configuration-name",
Expand Down Expand Up @@ -768,8 +768,8 @@ def dispatch_sub_command(cfg, sub_command):
racecontrol.run_async(cfg)
elif sub_command == "generate":
generate(cfg)
elif sub_command == "generate-track":
tracker.generate_track(cfg)
elif sub_command == "create-track":
tracker.create_track(cfg)
elif sub_command == "info":
track.track_info(cfg)
else:
Expand Down Expand Up @@ -913,7 +913,7 @@ def main():
else:
# other options are stored elsewhere already
cfg.add(config.Scope.applicationOverride, "generator", "node.count", args.node_count)
if sub_command == "generate-track":
if sub_command == "create-track":
cfg.add(config.Scope.applicationOverride, "generator", "indices", args.indices)
cfg.add(config.Scope.applicationOverride, "generator", "output.path", args.output_path)

Expand Down
6 changes: 3 additions & 3 deletions esrally/tracker/tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def extract_mappings_and_corpora(client, output_path, indices_to_extract):
return indices, corpora


def generate_track(cfg):
def create_track(cfg):
logger = logging.getLogger(__name__)

track_name = cfg.opts("track", "track.name")
Expand All @@ -64,7 +64,7 @@ def generate_track(cfg):
target_hosts = cfg.opts("client", "hosts")
client_options = cfg.opts("client", "options")

logger.info("Generating track [%s] matching indices [%s]", track_name, indices)
logger.info("Creating track [%s] matching indices [%s]", track_name, indices)

client = EsClientFactory(hosts=target_hosts.all_hosts[opts.TargetHosts.DEFAULT],
client_options=client_options.all_client_options[opts.TargetHosts.DEFAULT]).create()
Expand All @@ -90,4 +90,4 @@ def generate_track(cfg):
process_template(templates_path, "track.json.j2", template_vars, track_path)

console.println("")
console.info(f"Track {track_name} has been generated. Run it with: {PROGRAM_NAME} --track-path={output_path}")
console.info(f"Track {track_name} has been created. Run it with: {PROGRAM_NAME} --track-path={output_path}")
8 changes: 4 additions & 4 deletions it/tracker_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@ def test_cluster():


@it.rally_in_mem
def test_generate_track(cfg, tmp_path, test_cluster):
def test_create_track(cfg, tmp_path, test_cluster):
# prepare some data
cmd = f"--test-mode --pipeline=benchmark-only --target-hosts=127.0.0.1:{test_cluster.http_port} " \
f" --track=geonames --challenge=append-no-conflicts-index-only --quiet"
assert it.race(cfg, cmd) == 0

# generate the track
# create the track
track_name = f"test-track-{uuid.uuid4()}"
track_path = tmp_path / track_name

assert it.esrally(cfg, f"generate-track --target-hosts=127.0.0.1:{test_cluster.http_port} --indices=geonames "
assert it.esrally(cfg, f"create-track --target-hosts=127.0.0.1:{test_cluster.http_port} --indices=geonames "
f"--track={track_name} --output-path={tmp_path}") == 0

expected_files = ["track.json",
Expand All @@ -62,6 +62,6 @@ def test_generate_track(cfg, tmp_path, test_cluster):
full_path = track_path / f
assert full_path.exists(), f"Expected file to exist at path [{full_path}]"

# run a benchmark with the generated track
# run a benchmark with the created track
cmd = f"--test-mode --pipeline=benchmark-only --target-hosts=127.0.0.1:{test_cluster.http_port} --track-path={track_path}"
assert it.race(cfg, cmd) == 0

0 comments on commit 1745eb4

Please sign in to comment.