Skip to content

Commit

Permalink
WIP: Treat Slurm constraints with hyphens
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarak committed Nov 22, 2024
1 parent 2e3dee8 commit 6bacd24
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion reframe/core/schedulers/slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ def filternodes(self, job, nodes):
option_parser.add_argument('-w', '--nodelist')
option_parser.add_argument('-C', '--constraint')
option_parser.add_argument('-x', '--exclude')
self.log(f'[F] Slurm options: {" ".join(options)}')
parsed_args, _ = option_parser.parse_known_args(options)
reservation = parsed_args.reservation
partitions = parsed_args.partition
Expand Down Expand Up @@ -714,6 +715,7 @@ def satisfies(self, slurm_constraint):
# Convert the Slurm constraint to a Python expression and evaluate it,
# but restrict our syntax to accept only AND or OR constraints and
# their combinations
slurm_constraint = slurm_constraint.replace('-', '_')
if not re.match(r'^[\w\d\(\)\|\&]*$', slurm_constraint):
return False

Expand Down Expand Up @@ -751,7 +753,7 @@ def _extract_attribute(self, attr_name, node_descr, sep=None):
attr_match = re.search(r'%s=(\S+)' % attr_name, node_descr)
if attr_match:
attr = attr_match.group(1)
return set(attr_match.group(1).split(sep)) if sep else attr
return {n.replace('-', '_') for n in attr_match.group(1).split(sep)} if sep else attr

return None

Expand Down

0 comments on commit 6bacd24

Please sign in to comment.