Skip to content
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

feat: Correct behavior of matrix fallback priority, error on duplicate matrix selectors. #110

Merged
merged 4 commits into from
Sep 23, 2024

Conversation

bdice
Copy link
Contributor

@bdice bdice commented Sep 18, 2024

The README says,

Every matrices list must have a match for a given input matrix (only the first matching matrix in the list of matrices will be used).

However, it seems that the implemented behavior does not align with this. Only the fallback matrix worked in this way. This PR fixes the implementation to match the README (and our expectations).

We also decided it would be nice to fail if there are duplicate matrix selectors, since only the first one would be usable.

I added tests covered by both of these features/fixes.

@bdice bdice changed the title Fix matrix priority. feat: Correct behavior of matrix fallback priority, error on duplicate matrix selectors. Sep 21, 2024
@bdice bdice marked this pull request as ready for review September 21, 2024 00:22

if not found:
break
else:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

On the off chance that this is new to you: Python has a for/else construct that can be used to simplify things where you would otherwise need a loop with a "found" variable. It doesn't come up often in Python usage, but it's nice when it fits the problem cleanly. I was able to eliminate the found variable here with that approach.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for pointing this out, this was new to me.

Copy link
Member

@jameslamb jameslamb left a comment

Choose a reason for hiding this comment

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

This looks great to me, thanks for the test cases.

I pulled this and installed it, and tried the test case from cudf that led to this:

rapids-dependency-file-generator \
    --output conda \
    --file-key test_python \
    --matrix "cuda=12.2;arch=aarch64;py=3.10;dependencies=oldest"

Saw that produce output with cupy==12.2.0, meaning it matched the first matching entry in https://github.com/rapidsai/cudf/blob/9b4c4c721c399bae9e88733da79daa1a10644481/dependencies.yaml#L715-L724, exactly as we'd expect.

@bdice
Copy link
Contributor Author

bdice commented Sep 23, 2024

Thanks for the review @jameslamb! I'm going to merge this and deploy it so that we can get working nightlies for cudf branch-24.10 before code freeze.

@bdice bdice merged commit 298c61e into rapidsai:main Sep 23, 2024
4 checks passed
GPUtester pushed a commit that referenced this pull request Sep 23, 2024
# [1.15.0](v1.14.0...v1.15.0) (2024-09-23)

### Features

* Correct behavior of matrix fallback priority, error on duplicate matrix selectors. ([#110](#110)) ([298c61e](298c61e))
@GPUtester
Copy link

🎉 This PR is included in version 1.15.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants