From 79dc7c3d731264c9821a8949f5ac9630041c0d60 Mon Sep 17 00:00:00 2001 From: Simeon Ehrig Date: Mon, 18 Mar 2024 06:24:27 +0100 Subject: [PATCH] bashi-validate: remove required parameter - Removed required parameter because the filter works different compare to the original implementation from alpaka-job-matrix-library, where the implementation is coming from. Now the ordering of the parameters in a row is not fixed anymore. The filter rules also checks only for two parameter at the same time an tries to cancel an invalid combination early as possible. --- bashi/filter_backend.py | 13 ++----------- bashi/filter_compiler.py | 13 ++----------- bashi/filter_software_dependency.py | 13 ++----------- bashi/validate.py | 20 -------------------- 4 files changed, 6 insertions(+), 53 deletions(-) diff --git a/bashi/filter_backend.py b/bashi/filter_backend.py index f76bc1a..7fee8f6 100644 --- a/bashi/filter_backend.py +++ b/bashi/filter_backend.py @@ -7,18 +7,9 @@ which rule. """ -from typing import Optional, IO, List +from typing import Optional, IO from typeguard import typechecked -from bashi.types import Parameter, ParameterValueTuple - - -def get_required_parameters() -> List[Parameter]: - """Return list of parameters which will be checked in the filter. - - Returns: - List[Parameter]: list of checked parameters - """ - return [] +from bashi.types import ParameterValueTuple @typechecked diff --git a/bashi/filter_compiler.py b/bashi/filter_compiler.py index 814bf0d..4aa2fcb 100644 --- a/bashi/filter_compiler.py +++ b/bashi/filter_compiler.py @@ -7,11 +7,11 @@ which rule. """ -from typing import Optional, IO, List +from typing import Optional, IO import packaging.version as pkv from typeguard import typechecked from bashi.globals import * # pylint: disable=wildcard-import,unused-wildcard-import -from bashi.types import Parameter, ParameterValueTuple +from bashi.types import ParameterValueTuple from bashi.versions import NVCC_GCC_MAX_VERSION, NVCC_CLANG_MAX_VERSION from bashi.utils import reason @@ -19,15 +19,6 @@ # from bashi.utils import print_row_nice -def get_required_parameters() -> List[Parameter]: - """Return list of parameters which will be checked in the filter. - - Returns: - List[Parameter]: list of checked parameters - """ - return [HOST_COMPILER, DEVICE_COMPILER] - - @typechecked def compiler_filter_typechecked( row: ParameterValueTuple, diff --git a/bashi/filter_software_dependency.py b/bashi/filter_software_dependency.py index 4314402..0d6cd30 100644 --- a/bashi/filter_software_dependency.py +++ b/bashi/filter_software_dependency.py @@ -7,18 +7,9 @@ which rule. """ -from typing import Optional, IO, List +from typing import Optional, IO from typeguard import typechecked -from bashi.types import Parameter, ParameterValueTuple - - -def get_required_parameters() -> List[Parameter]: - """Return list of parameters which will be checked in the filter. - - Returns: - List[Parameter]: list of checked parameters - """ - return [] +from bashi.types import ParameterValueTuple @typechecked diff --git a/bashi/validate.py b/bashi/validate.py index 906f8e7..efb246d 100644 --- a/bashi/validate.py +++ b/bashi/validate.py @@ -182,7 +182,6 @@ def get_args() -> Namespace: def check_single_filter( filter_func: Callable[[ParameterValueTuple, Optional[IO[str]]], bool], row: ParameterValueTuple, - required_parameter: List[str], ) -> bool: """Check if row passes a filter function. @@ -194,8 +193,6 @@ def check_single_filter( Returns: bool: True if the row passes the filter. """ - missing_parameters = "" - # get name of the filter for command line output. filter_name: str = filter_func.__name__ @@ -204,20 +201,6 @@ def check_single_filter( if filter_name.endswith("_typechecked"): filter_name = filter_name[: -len("_typechecked")] - # check if all required parameter are available - for req_name in required_parameter: - if req_name not in row: - missing_parameters += " " + req_name - - if missing_parameters: - print( - cs( - f"skipped {filter_name}(), missing parameters ->" + missing_parameters, - "Yellow", - ) - ) - return False - msg = io.StringIO() if filter_func(row, msg): @@ -245,21 +228,18 @@ def check_filter_chain(row: ParameterValueTuple) -> bool: check_single_filter( bashi.filter_compiler.compiler_filter, row, - bashi.filter_compiler.get_required_parameters(), ) ) all_true += int( check_single_filter( bashi.filter_backend.backend_filter_typechecked, row, - bashi.filter_backend.get_required_parameters(), ) ) all_true += int( check_single_filter( bashi.filter_software_dependency.software_dependency_filter_typechecked, row, - bashi.filter_software_dependency.get_required_parameters(), ) )