Skip to content

Commit

Permalink
hwbench: Ensure no one is running below the minimal python version
Browse files Browse the repository at this point in the history
Even if the setup requires a minimal python version, this doesn't
prevent users from running a different python release at runtime.

This commit is about preventing hwbench to run on unsupported python
releases.

Signed-off-by: Erwan Velu <e.velu@criteo.com>
  • Loading branch information
ErwanAliasr1 committed Jul 4, 2024
1 parent cb123d0 commit e7665c4
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions hwbench/hwbench.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
import json
import os
import pathlib
import platform
import time

from .bench import benchmarks
from .bench.monitoring_structs import MonitorMetric
from .config import config
from .environment import software as env_soft
from .environment import hardware as env_hw
from packaging.version import Version
from .utils import helpers as h
from .tuning import setup as tuning_setup
from .utils.hwlogging import init_logging
Expand All @@ -21,6 +23,13 @@ def main():
if not is_root():
h.fatal("hwbench is not running as effective uid 0.")

# Let's ensure no one is running below the expected python release
min_python_release = "3.9"
if Version(platform.python_version()) < Version(min_python_release):
h.fatal(
f"Current python version {platform.python_version()} is below minimal supported release : {min_python_release}"
)

out_dir, tuning_out_dir = create_output_directory()
args = parse_options()

Expand Down

0 comments on commit e7665c4

Please sign in to comment.