Skip to content

Commit 690e793

Browse files
Enable ML release benchmarks
With this commit we ensure that ML-related benchmarks can be run for all release benchmarks starting with Elasticsearch 5.4.0. Relates elastic#39 Relates elastic#85
1 parent c20ac8f commit 690e793

File tree

2 files changed

+35
-15
lines changed

2 files changed

+35
-15
lines changed

night_rally/night_rally.py

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -228,26 +228,31 @@ def __init__(self, params, x_pack_config, distribution_version):
228228
])
229229

230230
def runnable(self, race_config):
231+
major, minor, _, _ = components(self.distribution_version)
232+
231233
# Do not run 1g benchmarks at all at the moment. Earlier versions of ES OOM.
232234
if race_config.car == "1gheap":
233235
return False
234236
# transport-nio has been introduced in Elasticsearch 7.0.
235-
if int(self.distribution_version[0]) < 7 and "transport-nio" in race_config.plugins:
237+
if major < 7 and "transport-nio" in race_config.plugins:
236238
return False
237239
# Currently transport-nio does not support HTTPS
238240
if self.x_pack_config and "transport-nio" in race_config.plugins:
239241
return False
240-
# Do not run with special x-pack configs. We run either the whole suite with or without x-pack.
241-
if race_config.x_pack:
242+
# Do not run with special x-pack security configs. We run either the whole suite with or without x-pack.
243+
if race_config.x_pack and "security" in race_config.x_pack:
244+
return False
245+
# ML has been introduced in 5.4.0
246+
if race_config.x_pack and "ml" in race_config.x_pack and (major < 5 or (major == 5 and minor < 4)):
242247
return False
243248
# noaa does not work on older versions. This should actually be specified in track.json and not here...
244-
if int(self.distribution_version[0]) < 5 and race_config.track == "noaa":
249+
if major < 5 and race_config.track == "noaa":
245250
return False
246251
# ingest pipelines were added in 5.0
247-
if int(self.distribution_version[0]) < 5 and "ingest-pipeline" in race_config.challenge:
252+
if major < 5 and "ingest-pipeline" in race_config.challenge:
248253
return False
249254
# cannot run "sorted" challenges - it's a 6.0+ feature
250-
if int(self.distribution_version[0]) < 6 and "sorted" in race_config.challenge:
255+
if major < 6 and "sorted" in race_config.challenge:
251256
return False
252257
return True
253258

@@ -403,19 +408,21 @@ class XPackParams:
403408
Extracts all parameters that are relevant for benchmarking with x-pack. Before Elasticsearch 6.3.0 x-pack is considered a plugin.
404409
For later versions it is treated as module.
405410
"""
406-
def __init__(self, distribution_version, override_x_pack=None):
411+
def __init__(self, distribution_version, additional_modules=None):
412+
if additional_modules is None:
413+
additional_modules = []
407414
if distribution_version == "master":
408415
self.treat_as_car = True
409416
else:
410417
major, minor, _, _ = components(distribution_version)
411418
self.treat_as_car = major > 6 or (major == 6 and minor >= 3)
412419

413420
self.distribution_version = distribution_version
414-
self.override_x_pack = override_x_pack
421+
self.additional_modules = additional_modules
415422

416423
def __call__(self, race_config):
417424
params = {}
418-
x_pack = self.override_x_pack if self.override_x_pack else race_config.x_pack
425+
x_pack = self.additional_modules + race_config.x_pack
419426
add_if_present(params, "client-options", self.client_options(x_pack))
420427
add_if_present(params, "elasticsearch-plugins", self.elasticsearch_plugins(x_pack))
421428
add_if_present(params, "car", self.car(x_pack))
@@ -487,7 +494,7 @@ def track_params(self):
487494

488495
@property
489496
def x_pack(self):
490-
return self.configuration.get("x-pack")
497+
return self.configuration.get("x-pack", [])
491498

492499
@property
493500
def target_hosts(self):

tests/night_rally_test.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -305,31 +305,44 @@ def test_run_release_benchmark_with_plugins(self, mocked_wait_until_port_is_free
305305
"x-pack": ["security"],
306306
"track-params": "bulk_size:1000"
307307
},
308-
308+
# should run an ML benchmark
309+
{
310+
"name": "geonames-4g-with-ml",
311+
"challenge": "append-ml",
312+
"car": "4gheap",
313+
"x-pack": ["ml"],
314+
},
309315
]
310316
}
311317
]
312318
start_date = datetime.datetime(2016, 1, 1)
313319
params = [night_rally.StandardParams("release", start_date, 8, {"env": "x-pack"})]
314-
cmd = night_rally.ReleaseCommand(params, ["security", "monitoring"], "5.3.0")
320+
cmd = night_rally.ReleaseCommand(params, ["security", "monitoring"], "5.4.0")
315321

316322
night_rally.run_rally(tracks, ["localhost"], cmd, skip_ansible=True, system=system_call)
317-
self.assertEqual(2, len(system_call.calls))
323+
self.assertEqual(3, len(system_call.calls))
318324
self.assertEqual(
319325
[
320326
"rally --skip-update --configuration-name=\"release\" --quiet --target-host=\"localhost:39200\" "
321327
"--effective-start-date=\"2016-01-01 00:00:00\" --track=\"geonames\" --challenge=\"append-no-conflicts\" "
322328
"--car=\"defaults\" --user-tag=\"env:x-pack,name:geonames-defaults,x-pack:true\" --runtime-jdk=\"8\" "
323329
"--track-params=\"bulk_size:3000\" --client-options=\"timeout:60,use_ssl:true,verify_certs:false,basic_auth_user:'rally',"
324330
"basic_auth_password:'rally-password'\" --elasticsearch-plugins=\"x-pack:security,monitoring\" "
325-
"--distribution-version=\"5.3.0\" --pipeline=\"from-distribution\"",
331+
"--distribution-version=\"5.4.0\" --pipeline=\"from-distribution\"",
326332

327333
"rally --skip-update --configuration-name=\"release\" --quiet --target-host=\"localhost:39200\" "
328334
"--effective-start-date=\"2016-01-01 00:00:00\" --track=\"geonames\" --challenge=\"append-no-conflicts\" "
329335
"--car=\"4gheap\" --user-tag=\"env:x-pack,name:geonames-4g,x-pack:true\" --runtime-jdk=\"8\" "
330336
"--track-params=\"bulk_size:2000\" --client-options=\"timeout:60,use_ssl:true,verify_certs:false,basic_auth_user:'rally',"
331337
"basic_auth_password:'rally-password'\" --elasticsearch-plugins=\"x-pack:security,monitoring\" "
332-
"--distribution-version=\"5.3.0\" --pipeline=\"from-distribution\"",
338+
"--distribution-version=\"5.4.0\" --pipeline=\"from-distribution\"",
339+
340+
"rally --skip-update --configuration-name=\"release\" --quiet --target-host=\"localhost:39200\" "
341+
"--effective-start-date=\"2016-01-01 00:00:00\" --track=\"geonames\" --challenge=\"append-ml\" "
342+
"--car=\"4gheap\" --user-tag=\"env:x-pack,name:geonames-4g-with-ml,x-pack:true\" --runtime-jdk=\"8\" "
343+
"--client-options=\"timeout:60,use_ssl:true,verify_certs:false,basic_auth_user:'rally',"
344+
"basic_auth_password:'rally-password'\" --elasticsearch-plugins=\"x-pack:security,monitoring,ml\" "
345+
"--distribution-version=\"5.4.0\" --pipeline=\"from-distribution\"",
333346
]
334347
,
335348
system_call.calls

0 commit comments

Comments
 (0)