Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/rename/procedure' into rename/pr…
Browse files Browse the repository at this point in the history
…ocedure
  • Loading branch information
beaioun committed Jan 12, 2024
2 parents e74c77f + c805865 commit 9f98d2b
Show file tree
Hide file tree
Showing 115 changed files with 501 additions and 491 deletions.
6 changes: 3 additions & 3 deletions docs/api/execute-test.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ Execute the `nyc_taxis` workload against an existing OpenSearch cluster with the
Argument | Description | Required
:--- | :--- |:---
`distribution-version` | Define the version of the OpenSearch distribution to download. Check https://opensearch.org/docs/version-history/ for released versions. | No
`provision-config-path` | Define the path to the provision_config_instance and plugin configurations to use. | No
`provision-config-repository` | Define repository from where Benchmark will load provision_configs and provision_config_instances (default: `default`). | No
`provision-config-revision` | Define a specific revision in the provision_config repository that Benchmark should use. | No
`cluster-config-path` | Define the path to the cluster-configs and plugin configurations to use. | No
`cluster-config-repository` | Define repository from where Benchmark will load cluster-configs (default: `default`). | No
`cluster-config-revision` | Define a specific revision in the cluster-config repository that Benchmark should use. | No
`test-execution-id` | Define a unique id for this test_execution. | No
`pipeline` | Select the pipeline to run. | No
`revision` | Define the source code revision for building the benchmark candidate. 'current' uses the source tree as is, 'latest' fetches the latest version on main. It is also possible to specify a commit id or an ISO timestamp. The timestamp must be specified as: "@ts" where "ts" must be a valid ISO 8601 timestamp, e.g. "@2013-07-27T10:37:00Z" (default: `current`). | No
Expand Down
8 changes: 4 additions & 4 deletions it/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,19 +162,19 @@ def __init__(self, cfg):
self.installation_id = None
self.http_port = None

def install(self, distribution_version, node_name, provision_config_instance, http_port):
def install(self, distribution_version, node_name, cluster_config, http_port):
self.http_port = http_port
transport_port = http_port + 100
try:
err, retcode = process.run_subprocess_with_stderr(
"opensearch-benchmark install --configuration-name={cfg} --distribution-version={dist} --build-type=tar "
"--http-port={http_port} --node={node_name} --master-nodes="
"{node_name} --provision-config-instance={provision_config_instance} "
"{node_name} --cluster-config={cluster_config} "
"--seed-hosts=\"127.0.0.1:{transport_port}\"".format(cfg=self.cfg,
dist=distribution_version,
http_port=http_port,
node_name=node_name,
provision_config_instance=provision_config_instance,
cluster_config=cluster_config,
transport_port=transport_port))
if retcode != 0:
raise AssertionError("Failed to install OpenSearch {}.".format(distribution_version), err)
Expand Down Expand Up @@ -207,7 +207,7 @@ def __init__(self):
def start(self):
self.cluster.install(distribution_version=OsMetricsStore.VERSION,
node_name="metrics-store",
provision_config_instance="defaults",
cluster_config="defaults",
http_port=10200)
self.cluster.start(test_execution_id="metrics-store")

Expand Down
4 changes: 3 additions & 1 deletion it/distribution_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_tar_distributions(cfg):
for workload in it.WORKLOADS:
it.wait_until_port_is_free(port_number=port)
assert it.execute_test(cfg, f"--distribution-version=\"{dist}\" --workload=\"{workload}\" "
f"--test-mode --provision-config-instance=4gheap --target-hosts=127.0.0.1:{port}") == 0
f"--test-mode --cluster-config=4gheap --target-hosts=127.0.0.1:{port}") == 0


@it.random_benchmark_config
Expand All @@ -44,3 +44,5 @@ def test_docker_distribution(cfg):
assert it.execute_test(cfg, f"--pipeline=\"docker\" --distribution-version=\"{dist}\" "
f"--workload=\"geonames\" --scenario=\"append-no-conflicts-index-only\" --test-mode "
f"--provision-config-instance=4gheap --target-hosts=127.0.0.1:{port}") == 0


6 changes: 3 additions & 3 deletions it/list_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ def test_list_test_executions(cfg):


@it.benchmark_in_mem
def test_list_provision_config_instances(cfg):
assert it.osbenchmark(cfg, "list provision_config_instances") == 0
assert it.osbenchmark(cfg, "list provision_config_instances --provision-config-repository=default") == 0
def test_list_cluster_configs(cfg):
assert it.osbenchmark(cfg, "list cluster-configs") == 0
assert it.osbenchmark(cfg, "list cluster-configs --cluster-config-repository=default") == 0


@it.benchmark_in_mem
Expand Down
2 changes: 2 additions & 0 deletions it/sources_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ def test_sources(cfg):
it.wait_until_port_is_free(port_number=port)
assert it.execute_test(cfg, f"--pipeline=from-sources --workload=geonames --test-mode --target-hosts=127.0.0.1:{port} "
f"--scenario=append-no-conflicts-index-only --provision-config-instance=\"4gheap,ea\"") == 0


2 changes: 1 addition & 1 deletion it/tracker_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def test_cluster():
test_execution_id = str(uuid.uuid4())

it.wait_until_port_is_free(port_number=port)
cluster.install(distribution_version=dist, node_name="benchmark-node", provision_config_instance="4gheap", http_port=port)
cluster.install(distribution_version=dist, node_name="benchmark-node", cluster_config="4gheap", http_port=port)
cluster.start(test_execution_id=test_execution_id)
yield cluster
cluster.stop()
Expand Down
114 changes: 57 additions & 57 deletions osbenchmark/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ def add_workload_source(subparser):
"configuration",
metavar="configuration",
help="The configuration for which Benchmark should show the available options. "
"Possible values are: telemetry, workloads, pipelines, test_executions, provision_config_instances, opensearch-plugins",
choices=["telemetry", "workloads", "pipelines", "test_executions", "provision_config_instances", "opensearch-plugins"])
"Possible values are: telemetry, workloads, pipelines, test_executions, cluster-configs, opensearch-plugins",
choices=["telemetry", "workloads", "pipelines", "test_executions", "cluster-configs", "opensearch-plugins"])
list_parser.add_argument(
"--limit",
help="Limit the number of search results for recent test_executions (default: 10).",
Expand Down Expand Up @@ -218,16 +218,16 @@ def add_workload_source(subparser):

download_parser = subparsers.add_parser("download", help="Downloads an artifact")
download_parser.add_argument(
"--provision-config-repository",
help="Define the repository from where Benchmark will load provision_configs and provision_config_instances (default: default).",
"--cluster-config-repository",
help="Define the repository from where Benchmark will load cluster-configs (default: default).",
default="default")
download_parser.add_argument(
"--provision-config-revision",
help="Define a specific revision in the provision_config repository that Benchmark should use.",
"--cluster-config-revision",
help="Define a specific revision in the cluster-config repository that Benchmark should use.",
default=None)
download_parser.add_argument(
"--provision-config-path",
help="Define the path to the provision_config_instance and plugin configurations to use.")
"--cluster-config-path",
help="Define the path to the cluster-config and plugin configurations to use.")
download_parser.add_argument(
"--distribution-version",
type=supported_os_version,
Expand All @@ -239,14 +239,14 @@ def add_workload_source(subparser):
help="Define the repository from where the OpenSearch distribution should be downloaded (default: release).",
default="release")
download_parser.add_argument(
"--provision-config-instance",
help=f"Define the provision_config_instance to use. List possible "
f"provision_config_instances with `{PROGRAM_NAME} list "
f"provision_config_instances` (default: defaults).",
"--cluster-config",
help=f"Define the cluster-config to use. List possible "
f"cluster-configs with `{PROGRAM_NAME} list "
f"cluster-configs` (default: defaults).",
default="defaults") # optimized for local usage
download_parser.add_argument(
"--provision-config-instance-params",
help="Define a comma-separated list of key:value pairs that are injected verbatim as variables for the provision_config_instance.",
"--cluster-config-params",
help="Define a comma-separated list of key:value pairs that are injected verbatim as variables for the cluster-config.",
default=""
)
download_parser.add_argument(
Expand All @@ -273,16 +273,16 @@ def add_workload_source(subparser):
choices=["tar", "docker"],
default="tar")
install_parser.add_argument(
"--provision-config-repository",
help="Define the repository from where Benchmark will load provision_configs and provision_config_instances (default: default).",
"--cluster-config-repository",
help="Define the repository from where Benchmark will load cluster-configs (default: default).",
default="default")
install_parser.add_argument(
"--provision-config-revision",
help="Define a specific revision in the provision_config repository that Benchmark should use.",
"--cluster-config-revision",
help="Define a specific revision in the cluster-config repository that Benchmark should use.",
default=None)
install_parser.add_argument(
"--provision-config-path",
help="Define the path to the provision_config_instance and plugin configurations to use.")
"--cluster-config-path",
help="Define the path to the cluster-config and plugin configurations to use.")
install_parser.add_argument(
"--runtime-jdk",
type=runtime_jdk,
Expand All @@ -299,14 +299,14 @@ def add_workload_source(subparser):
"Check https://opensearch.org/docs/version-history/ for released versions.",
default="")
install_parser.add_argument(
"--provision-config-instance",
help=f"Define the provision_config_instance to use. List possible "
f"provision_config_instances with `{PROGRAM_NAME} list "
f"provision_config_instances` (default: defaults).",
"--cluster-config",
help=f"Define the cluster-config to use. List possible "
f"cluster-configs with `{PROGRAM_NAME} list "
f"cluster-configs` (default: defaults).",
default="defaults") # optimized for local usage
install_parser.add_argument(
"--provision-config-instance-params",
help="Define a comma-separated list of key:value pairs that are injected verbatim as variables for the provision_config_instance.",
"--cluster-config-params",
help="Define a comma-separated list of key:value pairs that are injected verbatim as variables for the cluster-config.",
default=""
)
install_parser.add_argument(
Expand Down Expand Up @@ -397,15 +397,15 @@ def add_workload_source(subparser):
"Check https://opensearch.org/docs/version-history/ for released versions.",
default="")
p.add_argument(
"--provision-config-path",
help="Define the path to the provision_config_instance and plugin configurations to use.")
"--cluster-config-path",
help="Define the path to the cluster-config and plugin configurations to use.")
p.add_argument(
"--provision-config-repository",
help="Define repository from where Benchmark will load provision_configs and provision_config_instances (default: default).",
"--cluster-config-repository",
help="Define repository from where Benchmark will load cluster-configs (default: default).",
default="default")
p.add_argument(
"--provision-config-revision",
help="Define a specific revision in the provision_config repository that Benchmark should use.",
"--cluster-config-revision",
help="Define a specific revision in the cluster-configs repository that Benchmark should use.",
default=None)

test_execution_parser.add_argument(
Expand Down Expand Up @@ -440,14 +440,14 @@ def add_workload_source(subparser):
"--scenario",
help=f"Define the scenario to use. List possible scenarios for workloads with `{PROGRAM_NAME} list workloads`.")
test_execution_parser.add_argument(
"--provision-config-instance",
help=f"Define the provision_config_instance to use. List possible "
f"provision_config_instances with `{PROGRAM_NAME} list "
f"provision_config_instances` (default: defaults).",
"--cluster-config",
help=f"Define the cluster-config to use. List possible "
f"cluster-configs with `{PROGRAM_NAME} list "
f"cluster-configs` (default: defaults).",
default="defaults") # optimized for local usage
test_execution_parser.add_argument(
"--provision-config-instance-params",
help="Define a comma-separated list of key:value pairs that are injected verbatim as variables for the provision_config_instance.",
"--cluster-config-params",
help="Define a comma-separated list of key:value pairs that are injected verbatim as variables for the cluster-config.",
default=""
)
test_execution_parser.add_argument(
Expand All @@ -470,7 +470,7 @@ def add_workload_source(subparser):
"(default: localhost:9200).",
default="") # actually the default is pipeline specific and it is set later
test_execution_parser.add_argument(
"--load-worker-coordinator-hosts",
"--worker-ips",
help="Define a comma-separated list of hosts which should generate load (default: localhost).",
default="localhost")
test_execution_parser.add_argument(
Expand Down Expand Up @@ -605,8 +605,8 @@ def dispatch_list(cfg):
test_execution_orchestrator.list_pipelines()
elif what == "test_executions":
metrics.list_test_executions(cfg)
elif what == "provision_config_instances":
provision_config.list_provision_config_instances(cfg)
elif what == "cluster-configs":
provision_config.list_cluster_configs(cfg)
elif what == "opensearch-plugins":
provision_config.list_plugins(cfg)
else:
Expand Down Expand Up @@ -751,28 +751,28 @@ def configure_workload_params(arg_parser, args, cfg, command_requires_workload=T
cfg.add(config.Scope.applicationOverride, "workload", "exclude.tasks", opts.csv_to_list(args.exclude_tasks))


def configure_builder_params(args, cfg, command_requires_provision_config_instance=True):
if args.provision_config_path:
def configure_builder_params(args, cfg, command_requires_cluster_config=True):
if args.cluster_config_path:
cfg.add(
config.Scope.applicationOverride, "builder",
"provision_config.path", os.path.abspath(
io.normalize_path(args.provision_config_path)))
"cluster_config.path", os.path.abspath(
io.normalize_path(args.cluster_config_path)))
cfg.add(config.Scope.applicationOverride, "builder", "repository.name", None)
cfg.add(config.Scope.applicationOverride, "builder", "repository.revision", None)
else:
cfg.add(config.Scope.applicationOverride, "builder", "repository.name", args.provision_config_repository)
cfg.add(config.Scope.applicationOverride, "builder", "repository.revision", args.provision_config_revision)
cfg.add(config.Scope.applicationOverride, "builder", "repository.name", args.cluster_config_repository)
cfg.add(config.Scope.applicationOverride, "builder", "repository.revision", args.cluster_config_revision)

if command_requires_provision_config_instance:
if command_requires_cluster_config:
if args.distribution_version:
cfg.add(config.Scope.applicationOverride, "builder", "distribution.version", args.distribution_version)
cfg.add(config.Scope.applicationOverride, "builder", "distribution.repository", args.distribution_repository)
cfg.add(config.Scope.applicationOverride, "builder",
"provision_config_instance.names", opts.csv_to_list(
args.provision_config_instance))
"cluster_config.names", opts.csv_to_list(
args.cluster_config))
cfg.add(config.Scope.applicationOverride, "builder",
"provision_config_instance.params", opts.to_dict(
args.provision_config_instance_params))
"cluster_config.params", opts.to_dict(
args.cluster_config_params))


def configure_connection_params(arg_parser, args, cfg):
Expand Down Expand Up @@ -807,7 +807,7 @@ def dispatch_sub_command(arg_parser, args, cfg):
elif sub_command == "list":
cfg.add(config.Scope.applicationOverride, "system", "list.config.option", args.configuration)
cfg.add(config.Scope.applicationOverride, "system", "list.test_executions.max_results", args.limit)
configure_builder_params(args, cfg, command_requires_provision_config_instance=False)
configure_builder_params(args, cfg, command_requires_cluster_config=False)
configure_workload_params(arg_parser, args, cfg, command_requires_workload=False)
dispatch_list(cfg)
elif sub_command == "download":
Expand All @@ -826,7 +826,7 @@ def dispatch_sub_command(arg_parser, args, cfg):
cfg.add(config.Scope.applicationOverride, "builder", "master.nodes", opts.csv_to_list(args.master_nodes))
cfg.add(config.Scope.applicationOverride, "builder", "seed.hosts", opts.csv_to_list(args.seed_hosts))
cfg.add(config.Scope.applicationOverride, "builder",
"provision_config_instance.plugins", opts.csv_to_list(
"cluster_config.plugins", opts.csv_to_list(
args.opensearch_plugins))
cfg.add(config.Scope.applicationOverride, "builder", "plugin.params", opts.to_dict(args.plugin_params))
configure_builder_params(args, cfg)
Expand Down Expand Up @@ -859,8 +859,8 @@ def dispatch_sub_command(arg_parser, args, cfg):
cfg.add(
config.Scope.applicationOverride,
"worker_coordinator",
"load_worker_coordinator_hosts",
opts.csv_to_list(args.load_worker_coordinator_hosts))
"worker_ips",
opts.csv_to_list(args.worker_ips))
cfg.add(config.Scope.applicationOverride, "workload", "test.mode.enabled", args.test_mode)
configure_workload_params(arg_parser, args, cfg)
configure_connection_params(arg_parser, args, cfg)
Expand All @@ -869,7 +869,7 @@ def dispatch_sub_command(arg_parser, args, cfg):
cfg.add(config.Scope.applicationOverride, "builder", "runtime.jdk", args.runtime_jdk)
cfg.add(config.Scope.applicationOverride, "builder", "source.revision", args.revision)
cfg.add(config.Scope.applicationOverride, "builder",
"provision_config_instance.plugins", opts.csv_to_list(
"cluster_config.plugins", opts.csv_to_list(
args.opensearch_plugins))
cfg.add(config.Scope.applicationOverride, "builder", "plugin.params", opts.to_dict(args.plugin_params))
cfg.add(config.Scope.applicationOverride, "builder", "preserve.install", convert.to_bool(args.preserve_install))
Expand Down
Loading

0 comments on commit 9f98d2b

Please sign in to comment.