Skip to content

Commit

Permalink
Use Rally's artifact cache (elastic#252)
Browse files Browse the repository at this point in the history
With this commit we remove all logic in night-rally that attempts to
determine whether it needs to rebuild an artifact and instead relies on
Rally's artifact cache introduces in elastic/rally#992. We also add a
new fixture that wipes the cached artifacts before every nightly run in
order to keep the cache small.

Relates elastic/rally#992
  • Loading branch information
danielmitterdorfer committed May 11, 2020
1 parent 1d3312e commit 2f63f84
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 48 deletions.
1 change: 1 addition & 0 deletions night_rally.sh
Expand Up @@ -208,6 +208,7 @@ then
cd ${NIGHT_RALLY_HOME}/night_rally/fixtures/ansible
ansible-playbook -i inventory/production -u rally playbooks/update-rally.yml --extra-vars="rally_environment=${RALLY_ENVIRONMENT} in_vagrant=${IN_VAGRANT} skip_rally_update=${SKIP_RALLY_UPDATE}"
ansible-playbook -i inventory/production -u rally playbooks/check-drive-health.yml ${ANSIBLE_SKIP_TAGS_STRING} --extra-vars="in_vagrant=${IN_VAGRANT}"
ansible-playbook -i inventory/production -u rally playbooks/evict-artifact-cache.yml
ansible-playbook -i inventory/production -u rally playbooks/setup.yml ${ANSIBLE_SKIP_TAGS_STRING}

popd >/dev/null 2>&1
Expand Down
16 changes: 16 additions & 0 deletions night_rally/fixtures/ansible/playbooks/evict-artifact-cache.yml
@@ -0,0 +1,16 @@
---
- name: remove cached artifacts
# ============================================
hosts: target_hosts
gather_facts: true
become: true
become_user: jenkins

vars:
distributions_dir: '{{ ansible_env.HOME }}/.rally/benchmarks/distributions/'

tasks:
- name: delete distributions directory
file:
path: '{{ distributions_dir }}'
state: absent
Expand Up @@ -11,6 +11,7 @@ env.name = {{rally_environment}}
[source]
remote.repo.url = https://github.com/elastic/elasticsearch.git
elasticsearch.src.subdir = elasticsearch
cache = true

[benchmarks]
local.dataset.cache = {{rally_homedir}}/.rally/benchmarks/data
Expand Down
38 changes: 1 addition & 37 deletions night_rally/night_rally.py
Expand Up @@ -182,46 +182,10 @@ def command_line(self, race_config):


class SourceBasedCommand(BaseCommand):
class SourcePipelineParams:
def __init__(self):
self.pipeline = "from-sources-complete"
self.current_license = None
self.current_x_pack = None
self.current_plugins = None

def update_current_params(self, race_config):
self.current_license = race_config.license
self.current_x_pack = race_config.x_pack
self.current_plugins = race_config.plugins

def requires_rebuild(self, race_config):
if not self.current_license:
# First execution, build sources
return True
elif race_config.license != self.current_license:
return True
elif race_config.license == self.current_license and race_config.x_pack != self.current_x_pack:
# ES < 6.3 x-pack components are modules, need to rebuild
return True
elif race_config.plugins != self.current_plugins:
# Force rebuild if we run with plugins. They might have not been built yet.
return True
else:
return False

def __call__(self, race_config):
if self.requires_rebuild(race_config):
self.pipeline = "from-sources-complete"
else:
self.pipeline = "from-sources-skip-build"
self.update_current_params(race_config)

return {"pipeline": self.pipeline}

def __init__(self, params, revision):
self.params = ParamsFormatter(params=params + [
LicenseParams(distribution_version="master"),
SourceBasedCommand.SourcePipelineParams(),
ConstantParam("pipeline", "from-sources-complete"),
ConstantParam("revision", revision)
])

Expand Down
21 changes: 10 additions & 11 deletions tests/night_rally_test.py
Expand Up @@ -368,7 +368,7 @@ def test_run_two_oss_challenges_successfully(self, mocked_wait_until_port_is_fre
"--effective-start-date=\"2016-01-01 00:00:00\" --track-repository=\"default\" --track=\"geonames\" "
"--challenge=\"append-no-conflicts-index-only\" --car=\"4gheap\" --client-options=\"timeout:240\" "
"--user-tag=\"name:geonames-append-4g-1node,setup:bare,race-configs-id:{},license:oss\" --runtime-jdk=\"8\" "
"--track-params=\"{{\\\"number_of_replicas\\\": 0}}\" --pipeline=\"from-sources-skip-build\" "
"--track-params=\"{{\\\"number_of_replicas\\\": 0}}\" --pipeline=\"from-sources-complete\" "
"--revision=\"@2016-01-01T00:00:00Z\"".format(race_configs_id)
]
,
Expand Down Expand Up @@ -538,7 +538,7 @@ def test_run_two_mixed_license_challenges_successfully(self, mocked_wait_until_p
"--effective-start-date=\"2016-01-01 00:00:00\" --track-repository=\"default\" --track=\"geonames\" "
"--challenge=\"append-no-conflicts\" --car=\"4gheap\" --client-options=\"timeout:240\" "
"--user-tag=\"name:geonames-4g,setup:bare,race-configs-id:{},license:oss\" --runtime-jdk=\"8\" "
"--pipeline=\"from-sources-skip-build\" --revision=\"@2016-01-01T00:00:00Z\"".format(race_configs_id),
"--pipeline=\"from-sources-complete\" --revision=\"@2016-01-01T00:00:00Z\"".format(race_configs_id),

"rally --skip-update --configuration-name=\"nightly\" --quiet --target-host=\"localhost:39200\" "
"--effective-start-date=\"2016-01-01 00:00:00\" --track-repository=\"default\" --track=\"geonames\" "
Expand All @@ -550,7 +550,7 @@ def test_run_two_mixed_license_challenges_successfully(self, mocked_wait_until_p
"--effective-start-date=\"2016-01-01 00:00:00\" --track-repository=\"default\" --track=\"geonames\" "
"--challenge=\"append-no-conflicts\" --car=\"4gheap,basic-license\" --client-options=\"timeout:240\" "
"--user-tag=\"name:geonames-4g,setup:bare,race-configs-id:{},license:basic\" --runtime-jdk=\"8\" "
"--pipeline=\"from-sources-skip-build\" --revision=\"@2016-01-01T00:00:00Z\"".format(race_configs_id)
"--pipeline=\"from-sources-complete\" --revision=\"@2016-01-01T00:00:00Z\"".format(race_configs_id)
]
,
system_call.calls
Expand Down Expand Up @@ -621,7 +621,7 @@ def test_run_two_oss_tracks_successfully(self, mocked_wait_until_port_is_free):
"--effective-start-date=\"2016-10-01 00:00:00\" --track-repository=\"default\" --track=\"percolator\" "
"--challenge=\"append-no-conflicts\" --car=\"4gheap\" --client-options=\"timeout:240\" "
"--user-tag=\"name:percolator-4g,setup:bare,race-configs-id:{},license:oss\" "
"--runtime-jdk=\"8\" --pipeline=\"from-sources-skip-build\" "
"--runtime-jdk=\"8\" --pipeline=\"from-sources-complete\" "
"--revision=\"@2016-10-01T00:00:00Z\"".format(race_configs_id)
]
,
Expand Down Expand Up @@ -769,7 +769,6 @@ def test_run_three_sets_of_mixed_license_tracks_successfully(self, mocked_wait_u
'--runtime-jdk="8" --car-params="{{\\"xpack_ml_enabled\\": false, '
'\\"xpack_monitoring_enabled\\": false, \\"xpack_watcher_enabled\\": false}}" '
'--track-params="{{\\"number_of_replicas\\": 0}}" '
# recompile as license has changed
'--pipeline="from-sources-complete" --revision="@2016-10-01T00:00:00Z"'.format(race_configs_id),

'rally --skip-update --configuration-name="nightly" --quiet '
Expand All @@ -780,7 +779,7 @@ def test_run_three_sets_of_mixed_license_tracks_successfully(self, mocked_wait_u
',basic_auth_password:\'rally-password\'" '
'--user-tag="name:percolator-4g,setup:bare,race-configs-id:{},license:trial,x-pack:true" --runtime-jdk="8" '
'--car-params="{{\\"xpack_ml_enabled\\": false, \\"xpack_monitoring_enabled\\": false, '
'\\"xpack_watcher_enabled\\": false}}" --pipeline="from-sources-skip-build" '
'\\"xpack_watcher_enabled\\": false}}" --pipeline="from-sources-complete" '
'--revision="@2016-10-01T00:00:00Z"'.format(race_configs_id),

'rally --skip-update --configuration-name="nightly" --quiet '
Expand All @@ -791,7 +790,7 @@ def test_run_three_sets_of_mixed_license_tracks_successfully(self, mocked_wait_u
',basic_auth_password:\'rally-password\'" '
'--user-tag="name:percolator,setup:bare,race-configs-id:{},license:trial,x-pack:true" --runtime-jdk="8" '
'--car-params="{{\\"xpack_ml_enabled\\": false, \\"xpack_monitoring_enabled\\": false, '
'\\"xpack_watcher_enabled\\": false}}" --pipeline="from-sources-skip-build" '
'\\"xpack_watcher_enabled\\": false}}" --pipeline="from-sources-complete" '
'--revision="@2016-10-01T00:00:00Z"'.format(race_configs_id)
]
,
Expand Down Expand Up @@ -866,7 +865,7 @@ def test_run_adhoc_benchmark(self, mocked_wait_until_port_is_free):
"--effective-start-date=\"2016-10-01 00:00:00\" --track-repository=\"default\" --track=\"percolator\" "
"--challenge=\"append-no-conflicts\" --car=\"4gheap\" --client-options=\"timeout:240\" "
"--user-tag=\"name:percolator-4g,setup:bare,race-configs-id:{},license:oss\" --runtime-jdk=\"8\" "
"--pipeline=\"from-sources-skip-build\" --revision=\"66202dc\"".format(race_configs_id)
"--pipeline=\"from-sources-complete\" --revision=\"66202dc\"".format(race_configs_id)
]
,
system_call.calls
Expand Down Expand Up @@ -1601,7 +1600,7 @@ def test_run_continues_on_error(self, mocked_wait_until_port_is_free):
"--effective-start-date=\"2016-10-01 00:00:00\" --track-repository=\"default\" --track=\"percolator\" "
"--challenge=\"append-no-conflicts\" --car=\"4gheap\" --client-options=\"timeout:240\" "
"--user-tag=\"name:percolator-4g,setup:bare,license:oss\" --runtime-jdk=\"8\" "
"--pipeline=\"from-sources-skip-build\" --revision=\"@2016-10-01T00:00:00Z\""
"--pipeline=\"from-sources-complete\" --revision=\"@2016-10-01T00:00:00Z\""
]
,
system_call.calls
Expand Down Expand Up @@ -1718,13 +1717,13 @@ def test_run_with_telemetry_from_race_config(self, mocked_wait_until_port_is_fre
"--effective-start-date=\"2016-01-01 00:00:00\" --track-repository=\"default\" --track=\"geonames\" "
"--challenge=\"append-no-conflicts\" --car=\"4gheap\" --client-options=\"timeout:240\" "
"--user-tag=\"name:geonames-4g,setup:bare,license:oss\" --runtime-jdk=\"8\" "
"--telemetry=\"gc\" --pipeline=\"from-sources-skip-build\" --revision=\"@2016-01-01T00:00:00Z\"",
"--telemetry=\"gc\" --pipeline=\"from-sources-complete\" --revision=\"@2016-01-01T00:00:00Z\"",

"rally --skip-update --configuration-name=\"nightly\" --quiet --target-host=\"localhost:39200\" "
"--effective-start-date=\"2016-01-01 00:00:00\" --track-repository=\"default\" --track=\"geonames\" "
"--challenge=\"append-no-conflicts\" --car=\"8gheap\" --client-options=\"timeout:240\" "
"--user-tag=\"name:geonames-8g,setup:bare,license:oss\" --runtime-jdk=\"8\" --on-error=\"abort\" "
"--pipeline=\"from-sources-skip-build\" --revision=\"@2016-01-01T00:00:00Z\"",
"--pipeline=\"from-sources-complete\" --revision=\"@2016-01-01T00:00:00Z\"",
]
,
system_call.calls
Expand Down

0 comments on commit 2f63f84

Please sign in to comment.