Skip to content

[bugfix] Fix constraint evaluation for Slurm features starting with numbers #3448

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 8, 2025

Conversation

yqshao
Copy link
Contributor

@yqshao yqshao commented Apr 2, 2025

Features starting with a number (e.g. 4xA40) seem valid to slurm, but are not valid python identifiers. Currently this causes nodes getting filtered out when such feature is used as constraints. This prefixes all variables during eval with underscore to get around it.

Edit: this now inserts boolean values directly into the constraints to support such Slurm features.

@yqshao
Copy link
Contributor Author

yqshao commented Apr 2, 2025

👎 this naively breaks any expression, will try fix.

@vkarak
Copy link
Contributor

vkarak commented Apr 2, 2025

You can also try the unit tests locally by running ./test_reframe.py.

@yqshao yqshao closed this Apr 3, 2025
@github-project-automation github-project-automation bot moved this from Todo to Done in ReFrame Backlog Apr 3, 2025
@yqshao yqshao reopened this Apr 3, 2025
@github-project-automation github-project-automation bot moved this from Done to In Progress in ReFrame Backlog Apr 3, 2025
@yqshao yqshao force-pushed the develop branch 4 times, most recently from b91b06d to 4e6267d Compare April 3, 2025 01:02
@yqshao
Copy link
Contributor Author

yqshao commented Apr 3, 2025

I scratched the original idea of prefixing all symbols, as inserting the booleans directly seems easier if the symbols needs to be replaced anyway.

PS: Sorry for the force-push spam (I intended to rebase & tidy the history). I think it's ready to be reviewed now.

@yqshao yqshao changed the title [bugfix] prefix slurm features into valid python identifiers for eval [bugfix] fix evaluation of constraints containing Slurm features starting with numbers Apr 3, 2025
@yqshao yqshao changed the title [bugfix] fix evaluation of constraints containing Slurm features starting with numbers [bugfix] fix evaluation of constraints with Slurm features starting with numbers Apr 3, 2025
@yqshao yqshao changed the title [bugfix] fix evaluation of constraints with Slurm features starting with numbers [bugfix] fix constraint eval for Slurm features starting with numbers Apr 3, 2025
Evaluating Slurm feature as symbols (with dash replaced) won't work for
features like `8xT4` which are valid to Slurm. This commit directly inserts
existence of Slurm features as booleans. `re.sub` should avoid potentially
overlapping matches.
Copy link
Contributor

@vkarak vkarak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like very much your solution; it's much cleaner! I'll just need to test it a bit more thoroughly before merging it.

@vkarak vkarak added this to the ReFrame 4.8 milestone Apr 4, 2025
Copy link
Contributor

@vkarak vkarak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested it and it looks good. Just a couple of style comments.

Co-authored-by: Vasileios Karakasis <vkarak@gmail.com>
@yqshao
Copy link
Contributor Author

yqshao commented Apr 7, 2025

Thanks! Committed the suggested changes.

@vkarak vkarak changed the title [bugfix] fix constraint eval for Slurm features starting with numbers [bugfix] Fix constraint evaluation for Slurm features starting with numbers Apr 8, 2025
@vkarak vkarak enabled auto-merge April 8, 2025 11:12
@vkarak vkarak disabled auto-merge April 8, 2025 11:16
@vkarak vkarak merged commit 199a457 into reframe-hpc:develop Apr 8, 2025
68 of 69 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in ReFrame Backlog Apr 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants