-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Lukáš Doktor <ldoktor@redhat.com> * github.com:distributed-system-analysis/run-perf: contrib: Allow http/https pages only in rpm_links.py contrib: Simplify the find_rpms function docs: Port intersphinx_mapping to sphinx>=1.0 contrib: Example script to bisect using bisecter contrib: Add more colors to extract_data contrib: Include all good/bad results Actually implement the --host-rpms and --worker-rpms Store full args in Controller contrib: Circle through colors contrib: Sort the result paths to ensure we're getting stable results contrib: Set --average argument type
- Loading branch information
Showing
11 changed files
with
215 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
|
||
function usage { | ||
echo "usage: $0 BISECTER_WORKDIR CHECK_SCRIPT" | ||
echo | ||
echo "Can be used to bisect a regression" | ||
echo "BISECTER_WORKDIR - path to a directory with bisecter bisection in progress" | ||
echo "CHECK_SCRIPT - script to bisecter_bisect_check.sh like script that executes bisect.sh" | ||
exit -1 | ||
} | ||
|
||
[ "$#" -lt 2 ] && usage | ||
|
||
COMPAREPERF="${COMPAREPERF:-compare-perf}" | ||
|
||
BISECTER_WORKDIR=$(realpath "$1") | ||
CHECK_SCRIPT=$(realpath "$2") | ||
shift; shift | ||
RUNPERF_DIR=$(pwd) | ||
SCRIPT_DIR=$(realpath $(dirname "$0")) | ||
|
||
"$SCRIPT_DIR"/bisect.sh clean | ||
pushd "$BISECTER_WORKDIR" | ||
|
||
bisecter args || { echo "Bisecter in '$BISECTER_WORKDIR' not started"; exit -1; } | ||
|
||
"$CHECK_SCRIPT" good good | ||
"$CHECK_SCRIPT" bad bad | ||
bisecter run "$CHECK_SCRIPT" -- check | ||
BISECT_LOG=$(bisecter log) | ||
bisecter reset | ||
rm "$CHECK_SCRIPT" | ||
popd | ||
echo | ||
echo "---< HTML REPORT >---" | ||
"$SCRIPT_DIR"/bisect.sh report $COMPAREPERF | ||
echo | ||
echo "---< BISECT LOG >---" | ||
echo "$BISECT_LOG" | ||
echo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
#!/bin/env python3 | ||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; either version 2 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
# | ||
# See LICENSE for more details. | ||
# | ||
# Copyright: Red Hat Inc. 2023 | ||
# Author: Lukas Doktor <ldoktor@redhat.com> | ||
|
||
"""Helper to get links to RPMs from a base url""" | ||
|
||
import argparse | ||
import re | ||
import sys | ||
import urllib.request | ||
|
||
|
||
def get_filtered_links(page, link_filter=None, name_filter=None): | ||
""" | ||
Get links from http/https page and filter it according to filters | ||
:param page: Target url | ||
:param link_filter: link url filter | ||
:param name_filter: link name filter | ||
:return: list of links found on the page | ||
""" | ||
if not page.startswith('http://') and not page.startswith('https://'): | ||
return [] | ||
if link_filter is None: | ||
link_filter = '[^"]*' | ||
if name_filter is None: | ||
name_filter = '[^<]*' | ||
regex = f"href=\"({link_filter})\"[^>]*>({name_filter})<" | ||
sys.stderr.write(f'Looking for {regex} on {page}\n') | ||
with urllib.request.urlopen(page) as req: | ||
content = req.read().decode('utf-8') | ||
return re.findall(regex, content) | ||
|
||
|
||
def find_rpms(url, pkg_names, pkg_filter, arch): | ||
""" | ||
Parse argument into list of links | ||
:param url: Query a page for links (koji, python -m http.server, ...): | ||
:param pkg_names: Look only for links containing this name(s) | ||
:param pkg_filter: Look only for links not containing this name(s) | ||
:param arch: Look only for rpms of this and noarch type | ||
:return: list of individual links (eg.: | ||
["example.org/foo", "example.org/bar"]) | ||
""" | ||
|
||
link_filter = '[^\"]*' | ||
if pkg_filter: | ||
link_filter = f"(?!.*(?:{'|'.join(pkg_filter)}))" | ||
if pkg_names: | ||
link_filter += f"(?:{'|'.join(pkg_names)})" | ||
if arch: | ||
link_filter += f"[^\"]*(?:noarch|{arch})\\.rpm" | ||
else: | ||
link_filter += "[^\"]*\\.rpm" | ||
# Look for rpm_filter-ed rpms on base page | ||
links = get_filtered_links(url, link_filter) | ||
if links: | ||
return [urllib.parse.urljoin(url, link[0]) for link in links] | ||
# Look for rpm_filter-ed rpm in all $arch/ links | ||
for link in get_filtered_links(url, name_filter=f"{arch}/?"): | ||
links = find_rpms(urllib.parse.urljoin(url, link[0]), pkg_names, | ||
pkg_filter, arch) | ||
if links: | ||
return links | ||
raise RuntimeError(f"Unable to find any {link_filter} links in {url}") | ||
|
||
|
||
def main(cmdline=None): | ||
"""Cmdline handling wrapper to find_rpms""" | ||
parser = argparse.ArgumentParser(prog='rpm-links', description='Detects ' | ||
'links to all matching .rpm files ' | ||
'from the base URL(s)') | ||
parser.add_argument('--names', '-n', help='List of pkg names', nargs='*') | ||
parser.add_argument('--ignore', '-i', help='List names to be ignored ' | ||
'out', nargs='*') | ||
parser.add_argument('--arch', '-a', help='Target architecture') | ||
parser.add_argument('URLs', help='Base url (ensure proper "/" ending if ' | ||
'needed)', nargs='+') | ||
args = parser.parse_args(cmdline) | ||
links = [] | ||
for url in args.URLs: | ||
links.extend(find_rpms(url, args.names, args.ignore, args.arch)) | ||
print(' '.join(links)) | ||
return 0 | ||
|
||
|
||
if __name__ == '__main__': | ||
sys.exit(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
# Use $1 to set bisecter variant id or '--' to get current bisection id | ||
# | ||
# bisecter axis are: | ||
# 0 - distro | ||
# 1,2,3 - host rpms | ||
# 4,5 - guest rpms | ||
|
||
[ "$1" != '--' ] && ID="$1" || ID="$(bisecter id)" | ||
CHECK=$2 | ||
shift; shift | ||
|
||
SCRIPT_DIR=$(realpath $(dirname "$0")) | ||
RPM_LINKS="python $SCRIPT_DIR/rpm_links.py --ignore debug docs --arch x86_64" | ||
|
||
HOST="SPECIFY HOST HERE" | ||
PASS="SPECIFY PASSWORD(s) HERE" | ||
DISTRO=$(bisecter args -i $ID 0) | ||
HOST_RPMS=$($RPM_LINKS "$(bisecter args -i $ID 1)" "$(bisecter args -i $ID 2)" "$(bisecter args -i $ID 3)") | ||
WORKER_RPMS=$($RPM_LINKS "$(bisecter args -i $ID 4)" "$(bisecter args -i $ID 5)") | ||
|
||
# Run the run-perf and compare-perf | ||
"$SCRIPT_DIR/bisect.sh" "$CHECK" "$ID" run-perf -v --host-setup-script-reboot --hosts $HOST --default-password $PASS --distro "$DISTRO" --host-rpms $HOST_RPMS --worker-rpms $WORKER_RPMS --profiles 'Localhost' -- 'fio:{"runtime": "10", "targets": "/fio", "block-sizes": "4", "test-types": "read", "samples": "1", "numjobs": "1", "iodepth": "1", "__NAME__": "fio-rot-1j-1i"}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters