Skip to content

Commit 0f46df9

Browse files
Set tag for release benchmarks based on fixtures
With this commit we analyze the provided fixtures to determine whether this is a "normal" release benchmark or a release benchmark that is running against an encrypted volume. To tell apart both, we set different tags in Rally. Relates elastic#18
1 parent 96dc9a6 commit 0f46df9

File tree

3 files changed

+46
-15
lines changed

3 files changed

+46
-15
lines changed

convert.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import json
2+
import elasticsearch
3+
import elasticsearch.helpers
4+
5+
6+
def main():
7+
count = 0
8+
es = elasticsearch.Elasticsearch()
9+
docs = elasticsearch.helpers.scan(es, query={"query": {"match_all": {}}}, size=10000)
10+
with open("documents.json", "wt", encoding="UTF-8") as f:
11+
for doc in docs:
12+
if count % 100000 == 0:
13+
print(".", flush=True, end="")
14+
json.dump({"index": {"_index": doc["_index"], "_type": doc["_type"]}}, f)
15+
f.write("\n")
16+
json.dump(doc["_source"], f)
17+
f.write("\n")
18+
count += 1
19+
print("\nDone")
20+
21+
22+
if __name__ == '__main__':
23+
main()

night_rally.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,12 @@ def __init__(self, revision, effective_start_date, target_host, root_dir, config
223223

224224

225225
class ReleaseCommand(BaseCommand):
226-
def __init__(self, effective_start_date, target_host, root_dir, distribution_version, configuration_name):
226+
def __init__(self, effective_start_date, target_host, root_dir, distribution_version, configuration_name, tag):
227227
super().__init__(effective_start_date, target_host, root_dir)
228228
self.configuration_name = configuration_name
229229
self.pipeline = "from-distribution"
230230
self.distribution_version = distribution_version
231+
self._tag = tag
231232

232233
def runnable(self, track, challenge, car):
233234
# cannot run "sorted" challenges - it's a 6.0+ feature
@@ -243,9 +244,8 @@ def command_line(self, track, challenge, car):
243244
self.target_host, self.configuration_name, self.tag(), RALLY_BINARY)
244245
return cmd
245246

246-
@staticmethod
247-
def tag():
248-
return "env:bare"
247+
def tag(self):
248+
return self._tag
249249

250250

251251
class DockerCommand(BaseCommand):
@@ -601,7 +601,7 @@ def report(tracks, default_setup_per_track, reader, reporter):
601601
reporter.write_meta_report(track, meta_metrics["source_revision"])
602602

603603

604-
def copy_results_for_release_comparison(effective_start_date, dry_run):
604+
def copy_results_for_release_comparison(effective_start_date, dry_run, tag):
605605
if not dry_run:
606606
import client
607607
import elasticsearch.helpers
@@ -631,7 +631,7 @@ def copy_results_for_release_comparison(effective_start_date, dry_run):
631631
# pseudo version for stable comparisons
632632
src["distribution-version"] = "master"
633633
src["environment"] = "release"
634-
src["user-tag"] = ReleaseCommand.tag()
634+
src["user-tag"] = tag
635635
release_results.append(src)
636636
if release_results:
637637
logger.info("Copying %d result documents for [%s] to release environment." % (len(release_results), ts))
@@ -724,6 +724,10 @@ def parse_args():
724724
"--target-host",
725725
help="The Elasticsearch node that should be targeted",
726726
required=True)
727+
parser.add_argument(
728+
"--fixtures",
729+
help="A comma-separated list of fixtures that have been run",
730+
required=True)
727731
parser.add_argument(
728732
"--dry-run",
729733
help="Does not do anything, just output",
@@ -757,6 +761,7 @@ def main():
757761
nightly_mode = args.mode == "nightly"
758762
root_dir = config["root.dir"] if not args.override_root_dir else args.override_root_dir
759763
tag = args.tag
764+
release_tag = "env:ear" if "encryption-at-rest" in args.fixtures else "env:bare"
760765

761766
if release_mode:
762767
# use always the same name for release comparison benchmarks
@@ -765,7 +770,7 @@ def main():
765770
command = DockerCommand(args.effective_start_date, args.target_host, root_dir, args.release, env_name)
766771
tag = command.tag()
767772
else:
768-
command = ReleaseCommand(args.effective_start_date, args.target_host, root_dir, args.release, env_name)
773+
command = ReleaseCommand(args.effective_start_date, args.target_host, root_dir, args.release, env_name, release_tag)
769774
tag = command.tag()
770775
elif adhoc_mode:
771776
# copy data from templates directory to our dedicated output directory
@@ -781,7 +786,7 @@ def main():
781786
replace_release = args.replace_release if args.replace_release else args.release
782787

783788
if nightly_mode:
784-
copy_results_for_release_comparison(args.effective_start_date, args.dry_run)
789+
copy_results_for_release_comparison(args.effective_start_date, args.dry_run, release_tag)
785790
# we want to deactivate old release entries, not old nightly entries
786791
deactivate_outdated_results(args.effective_start_date, "release", args.release, tag, args.dry_run)
787792
else:

night_rally.sh

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,17 @@ else
139139
ANSIBLE_SKIP_TAGS_STRING="--skip-tags $ANSIBLE_SKIP_TAGS_STRING"
140140
fi
141141

142-
pushd . >/dev/null 2>&1
143-
144-
cd ${NIGHT_RALLY_HOME}/fixtures/ansible
145142
echo "About to run ansible-playbook ... with '$ANSIBLE_SKIP_TAGS_STRING'"
146-
ansible-playbook -i inventory/production -u rally playbooks/update-rally.yml
147-
ansible-playbook -i inventory/production -u rally playbooks/setup.yml $ANSIBLE_SKIP_TAGS_STRING
143+
if [ ${DRY_RUN} == NO ]
144+
then
145+
pushd . >/dev/null 2>&1
148146

149-
popd >/dev/null 2>&1
147+
cd ${NIGHT_RALLY_HOME}/fixtures/ansible
148+
ansible-playbook -i inventory/production -u rally playbooks/update-rally.yml
149+
ansible-playbook -i inventory/production -u rally playbooks/setup.yml ${ANSIBLE_SKIP_TAGS_STRING}
150+
151+
popd >/dev/null 2>&1
152+
fi
150153

151154
if [ -n "${OVERRIDE_SRC_DIR}" ]
152155
then
@@ -202,7 +205,7 @@ fi
202205
#****************************
203206
set +e
204207
# Avoid failing before we transferred all results. Usually only a single benchmark trial run fails but lots of other succeed.
205-
python3 ${NIGHT_RALLY_HOME}/night_rally.py --target-host=${TARGET_HOST} --effective-start-date="${START_DATE}" ${NIGHT_RALLY_OVERRIDE} --mode=${MODE} ${NIGHT_RALLY_DRY_RUN} --revision="${REVISION}" --release="${RELEASE}" --replace-release="${REPLACE_RELEASE}" --tag="${TAG}"
208+
python3 ${NIGHT_RALLY_HOME}/night_rally.py --target-host=${TARGET_HOST} --effective-start-date="${START_DATE}" ${NIGHT_RALLY_OVERRIDE} --mode=${MODE} ${NIGHT_RALLY_DRY_RUN} --fixtures="${FIXTURES}" --revision="${REVISION}" --release="${RELEASE}" --replace-release="${REPLACE_RELEASE}" --tag="${TAG}"
206209
exit_code=$?
207210

208211
echo "Killing any lingering Rally processes"

0 commit comments

Comments
 (0)