...
 
Commits (11)
......@@ -159,5 +159,6 @@ trigger_build:
only:
refs:
- master
- lachlanmackenzie/DontFallOverIfBuildstreamCommitIsBorked
artifacts:
paths: [ 'results_out/', 'results_cache/', 'pipeline_cache/' ]
......@@ -365,6 +365,12 @@ def prepare_volume(docker_client, volume_spec, versions_dict):
unique_version_name = volume_spec.prepare.version + '.' + \
volume_spec.prepare.repo.replace(':', '.').replace('/', '.').lower()
version = versions_dict[unique_version_name]
if not version:
logging.error("Buildstream version used to create volume corrupt"
"unable to create volume %s", volume_spec.prepare.version)
raise RuntimeError(
"Volume requires corrupted version: '{}'".format(
volume_spec.prepare.version))
except KeyError:
raise RuntimeError(
"Volume requires unknown version: '{}'".format(
......@@ -435,6 +441,12 @@ def run_benchmark(docker_client, version, test_spec, volumes_dict):
logging.info("Running test '%s' on version '%s'. Repeats: %s",
test_spec.name, version.spec.name, test_spec.repeats)
if not version:
logging.error("Unable to test required version, skipping test %s on version %s",
test_spec.name, version.spec.name)
raise RuntimeError("Unable to test required version, skipping test {} on version {}"
.format(test_spec.name, version.spec.name))
all_measurements = []
for i in range(0, test_spec.repeats):
......@@ -443,6 +455,11 @@ def run_benchmark(docker_client, version, test_spec, volumes_dict):
mounts = []
for mount in test_spec.mounts:
volume = volumes_dict[mount.volume]
if volume is None:
logging.error("Unable to mount required volume, skipping test %s on version %s",
test_spec.name, version.spec.name)
raise RuntimeError("Unable to mount required volume, skipping test {} on version {}"
.format(test_spec.name, version.spec.name))
mounts.append(
docker.types.Mount(target=mount.path, source=volume.id)
)
......@@ -556,25 +573,38 @@ def run(config_files, _debug, keep_images, reuse_images, output_file):
if reuse_images:
version = reuse_prepared_version(docker_client, version_spec)
if version is None:
version = prepare_version(docker_client, version_spec, bs_repo=repos_dict)
try:
version = prepare_version(docker_client, version_spec, bs_repo=repos_dict)
except: # pylint: disable=bare-except
logging.error("Unable to prepare version %s skipping", version_spec)
version = None
versions_dict[version_spec.unique_ref] = version
for volume_spec in benchmark_config.volume_specs:
volume = prepare_volume(docker_client, volume_spec, versions_dict)
try:
volume = prepare_volume(docker_client, volume_spec, versions_dict)
except Exception as e: # pylint: disable=broad-except
logging.error("Unable to prepare volume version %s skipping", e)
volume = None
volumes_dict[volume_spec.name] = volume
results_list = []
for test in benchmark_config.test_specs:
result = TestResult(test)
for version in versions_dict.values():
result_for_version = run_benchmark(docker_client, version, test, volumes_dict)
try:
result_for_version = run_benchmark(docker_client, version, test, volumes_dict)
except: # pylint: disable=bare-except
logging.error("Unable to to test version skipping")
continue
result.record_result_for_version(version, *result_for_version)
results_list.append(result)
if not keep_images and not reuse_images:
logging.info("Deleting test-specific Docker images")
for version in versions_dict.values():
docker_client.images.remove(version.image.id)
if version is not None:
docker_client.images.remove(version.image.id)
for cont in container_set:
subprocess.run(["docker", "rm", str(cont)])
......@@ -583,14 +613,23 @@ def run(config_files, _debug, keep_images, reuse_images, output_file):
logging.info("BuildStream benchmark runner finished at %s", end_time)
logging.info("Writing results to stdout")
vers = []
for ver in versions_dict.values():
if ver is not None:
vers.append(ver)
ress = []
for res in results_list:
if res is not None:
ress.append(res)
output = {
'start_timestamp': start_time.timestamp(),
'end_timestamp': end_time.timestamp(),
'host_info': host_info,
'benchmarking_sha': benchmarking_git_sha,
'versions': [version.describe() for version in versions_dict.values()],
'tests': [result.describe() for result in results_list]
'versions': [version.describe() for version in vers],
'tests': [result.describe() for result in ress]
}
if output_file:
logging.info("Writing to file %s", output_file)
try:
......
......@@ -243,6 +243,13 @@ def generate_token_file(file_path, buildstream_sha, buildstream_branch, last_res
# Init repo based upon parent directory
bench_mark_repo = git.Repo(search_parent_directories=True)
# Check if current benchmark branch is detached
if bench_mark_repo.head.is_detached:
_bm_branch = bench_mark_repo.head.name
else:
_bm_branch = bench_mark_repo.active_branch
# Write configuration file for token file
data = dict(
build=dict(
......@@ -250,7 +257,7 @@ def generate_token_file(file_path, buildstream_sha, buildstream_branch, last_res
bs_sha=str(buildstream_sha),
bs_branch=str(buildstream_branch),
bm_sha=str(bench_mark_repo.head.object.hexsha),
bm_branch=str(bench_mark_repo.head.name),
bm_branch=str(_bm_branch),
file=str(last_result))
)
try:
......