CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
64 lines
1.9 KiB
Python
64 lines
1.9 KiB
Python
#!/usr/bin/env python3
|
|
# Copyright (c) Advanced Micro Devices, Inc.
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
"""
|
|
Hash consistency guard for rocprofiler-compute.
|
|
|
|
Errors when an arch's panel YAML files diverge from the hashes recorded in
|
|
.config_hashes.json without the DB being refreshed.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
PROJECT_ROOT = Path(__file__).resolve().parents[2] # rocprofiler-compute/
|
|
if str(PROJECT_ROOT) not in sys.path:
|
|
sys.path.insert(0, str(PROJECT_ROOT))
|
|
|
|
from tools.config_management import hash_manager # noqa: E402
|
|
|
|
|
|
def main() -> int:
|
|
configs_root = hash_manager.ANALYSIS_CONFIGS_PATH
|
|
if not configs_root.is_dir():
|
|
print(f"ERROR: analysis_configs directory not found at: {configs_root}")
|
|
return 2
|
|
|
|
changes: dict = hash_manager.detect_changes(configs_root, hash_manager.HASH_DB_PATH)
|
|
|
|
errors: list[str] = [
|
|
f"Arch '{arch}' removed from disk but still in .config_hashes.json.\n"
|
|
"Run hash_manager.py --compute-all to refresh the DB."
|
|
for arch in (changes.get("deleted_archs") or [])
|
|
]
|
|
|
|
for arch in changes.get("new_archs") or []:
|
|
errors.append(
|
|
f"New arch '{arch}' has no entry in .config_hashes.json.\n"
|
|
"Run hash_manager.py --compute-all to refresh the DB."
|
|
)
|
|
|
|
for arch, changed_files in (changes.get("modified_archs") or {}).items():
|
|
snippet = ", ".join(changed_files[:5])
|
|
errors.append(
|
|
f"Panels changed in arch '{arch}' but hash DB was not refreshed.\n"
|
|
f"Changed panels (sample): {snippet}\n"
|
|
"Run hash_manager.py --compute-all to refresh the DB."
|
|
)
|
|
|
|
if errors:
|
|
print("\nHASH CONSISTENCY ERRORS:")
|
|
for e in errors:
|
|
print(" - " + e)
|
|
return 1
|
|
|
|
print("Hash consistency check passed.")
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|