diff --git a/reframe/core/schedulers/slurm.py b/reframe/core/schedulers/slurm.py index 240ea1beb..1a4d404fb 100644 --- a/reframe/core/schedulers/slurm.py +++ b/reframe/core/schedulers/slurm.py @@ -734,11 +734,10 @@ def satisfies(self, slurm_constraint: str): for grp in re.finditer(r'(\w(\w|\d)*)', slurm_constraint)} slurm_constraint = slurm_constraint.replace( "&", " and ").replace("|", " or ") - expr = " ".join([f"vars['{key}']" if key not in [ - 'and', 'or' - ] else key - for key in slurm_constraint.split()]) - + # Pattern to extract the variable names + pattern = r'\b(?!and\b|or\b)(\d*[a-zA-Z_]\w*)\b' + # Replace each variable with var['variable'] + expr = re.sub(pattern, r"vars['\1']", slurm_constraint) vars = {n: True for n in self.active_features} vars.update({n: False for n in names - self.active_features}) try: diff --git a/requirements.txt b/requirements.txt index 180c75339..1f2235de0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,6 @@ archspec==0.2.5 argcomplete==3.1.2; python_version < '3.8' argcomplete==3.5.1; python_version >= '3.8' autopep8==2.0.4 -autopep8==2.0.4 filelock==3.4.1; python_version == '3.6' filelock==3.12.2; python_version == '3.7' filelock==3.16.1; python_version >= '3.8' diff --git a/setup.cfg b/setup.cfg index 642a277bc..690a0c21c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -29,6 +29,7 @@ install_requires = archspec >= 0.2.4 argcomplete argcomplete <= 3.1.2; python_version < '3.8' + autopep8 filelock filelock<=3.12.2; python_version == '3.7' filelock<=3.4.1; python_version == '3.6'