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

Continue on missing variant packages #1550

Conversation

dgovil
Copy link
Contributor

@dgovil dgovil commented Oct 20, 2023

This PR adds a new config variable called error_on_missing_variant_requires that controls what happens when a variant lists missing packages in its requirements.

By default, it is True and will continue the existing behaviour of erroring when it encounters a variant with missing packages in its list of requirements. This means that if the first variant encounters a missing package in its request, it will not continue even if the second variant can resolve.

If it is disabled, it will print to stderr, treat the current phase as failed and continue on to the next phase. If all variants fail, it will be the same as if no variants could resolve.

This is of use to use internally because we often encounter the following scenarios:

  1. Since we only cache the packages that have been resolved, it means that when a user goes offline, they hit resolve errors because they can't access packages used by a variant that they aren't even trying to resolve.
  2. For the same reason, when we introduce other platforms into the mix, they won't cache down macOS specific packages and error when a resolve tries that path.
  3. Some of our users aren't allowed to access certain packages due to security reasons.

In each of these cases, another variant further down the list would have successfully resolved, but does not get the chance since an exception is immediately raised.

@dgovil dgovil requested a review from a team as a code owner October 20, 2023 21:30
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Oct 20, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

@dgovil dgovil changed the title Continue on missing packages Continue on missing variant packages Oct 20, 2023
@JeanChristopheMorinPerso
Copy link
Member

Hi @dgovil ! THanks for creating this PR! I remember our discussion on that a couple of months ago and I think it make sense.

Could you fix the DCO check (you can follow the instructions in https://github.com/AcademySoftwareFoundation/rez/pull/1550/checks?check_run_id=17914385709) and also edit the PR description to replace package/variants where appropriate?

For example:

1c1
< By default, it is True and will continue the existing behaviour of erroring when it encounters a variant with missing packages. This means that if the first variant encounters a missing package, it will not continue even if the second variant can resolve.
---
> By default, it is True and will continue the existing behaviour of erroring when it encounters a package with missing variants. This means that if the first package encounters a missing variant, it will not continue even if the second variant can resolve.

I feel like that would make more sense or did I misunderstood something?

Copy link
Member

@JeanChristopheMorinPerso JeanChristopheMorinPerso left a comment

Choose a reason for hiding this comment

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

Thanks for adding a test! I think we should also add a test to test when only one variant is missing?

src/rez/rezconfig.py Outdated Show resolved Hide resolved
src/rez/rezconfig.py Outdated Show resolved Hide resolved
@JeanChristopheMorinPerso JeanChristopheMorinPerso added the Blocked by DCO Waiting on commit signoff label Oct 20, 2023
…ssing package in a variant as a failed variant rather than an immediate error

Signed-off-by: Dhruv Govil <dgovil2@apple.com>
Signed-off-by: Dhruv Govil <dgovil2@apple.com>
Signed-off-by: Dhruv Govil <dgovil2@apple.com>
@dgovil dgovil force-pushed the continue_on_missing_packages branch from c218686 to c3dc3c5 Compare October 20, 2023 23:06
@JeanChristopheMorinPerso JeanChristopheMorinPerso removed the Blocked by DCO Waiting on commit signoff label Oct 21, 2023
Signed-off-by: Dhruv Govil <dgovil2@apple.com>
Signed-off-by: Dhruv Govil <dgovil2@apple.com>
Signed-off-by: Dhruv Govil <dgovil2@apple.com>
@dgovil
Copy link
Contributor Author

dgovil commented Oct 21, 2023

Addressed the notes above:

  1. I changed it from missing_variant_packages to missing_variant_requires because that is the term that seems to be used for the list of items in a variant per the Scope code.
  2. Moved it to the package resolution section
  3. Clarified the PR title+description that its talking about the variant requirements based on the term used by the Scope solve code

Let me know if there's anything else I can do for this PR.

Signed-off-by: Dhruv Govil <dgovil2@apple.com>
Signed-off-by: Dhruv Govil <dgovil2@apple.com>
@dgovil
Copy link
Contributor Author

dgovil commented Oct 22, 2023

I fixed the linter issues. I don't know how to fix the copyright one. I filed #1554 because the copyright script doesn't work on macOS, but I don't see copyright information on any of the other tests. I tried adding the generic spdx header from other files but it doesn't seem to be happy with that either.

dgovil and others added 2 commits October 22, 2023 09:26
Signed-off-by: Dhruv Govil <dgovil2@apple.com>
Signed-off-by: Jean-Christophe Morin <jean_christophe_morin@hotmail.com>
@JeanChristopheMorinPerso
Copy link
Member

@dgovil the copyright workflow is now passing. We should really rework it as it's non intuitive and always give us problems. I'd like o move to use an open source tool instead of writing our own.

@JeanChristopheMorinPerso
Copy link
Member

Note to myself or @dgovil, we should run the benchmarks to ensure that we didn't change the solver in an unexpected way. Feel free to run them, but I will also understand if you don't feel like it since they are not documented at all. If you don't want to run them, I'll run them for you. Just let me know.

@JeanChristopheMorinPerso JeanChristopheMorinPerso added this to the Next milestone Oct 22, 2023
@dgovil
Copy link
Contributor Author

dgovil commented Oct 22, 2023

How does one run it?

@JeanChristopheMorinPerso
Copy link
Member

I think I'll just push a commit on main to enable us to run the benchmark on selected PRs (via a label). But if you are curious, see https://github.com/AcademySoftwareFoundation/rez/blob/main/.github/workflows/benchmark.yaml.

@JeanChristopheMorinPerso JeanChristopheMorinPerso added the run-benchmarks Add this label to a PR to run the benchmarks label Oct 27, 2023
@JeanChristopheMorinPerso
Copy link
Member

JeanChristopheMorinPerso commented Oct 27, 2023

@dgovil I merged the main branch and the benchmark will now run on your PR.

@JeanChristopheMorinPerso
Copy link
Member

And there seems to no no noticeable differences in terms of spee and no resolve failed: https://github.com/AcademySoftwareFoundation/rez/actions/runs/6661912380/attempts/1#summary-18105674262

Copy link
Member

@JeanChristopheMorinPerso JeanChristopheMorinPerso left a comment

Choose a reason for hiding this comment

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

Great job @dgovil ! Thanks for editing the docs. I think they are clearer now. We might want to eventually add more docs on when this is useful, but for this PR, I think the documentation is enough.

Your PR will be released in rez 2.114.0 or 3.0.0. I'm not yet sure in which release it will go. 2.114.0 should hopefully be released in a week or two. 3.0.0 is planned for early january.

@dgovil
Copy link
Contributor Author

dgovil commented Nov 7, 2023 via email

@maxnbk
Copy link
Contributor

maxnbk commented Nov 16, 2023

Requested a comment in the config that mem-caching of resolves might be affected ; In fact, this needs to be verified, but was a potential concern that was deemed not important enough to warrant holding the PR back. nonetheless, a note in the config and a TODO in the code would be sufficient, and we should make a github issue to track whether or not it is in fact an issue.
Thanks @dgovil !

Signed-off-by: Dhruv Govil <dgovil2@apple.com>
@JeanChristopheMorinPerso JeanChristopheMorinPerso removed the run-benchmarks Add this label to a PR to run the benchmarks label Nov 17, 2023
@JeanChristopheMorinPerso
Copy link
Member

Looks good to me. Thanks again @dgovil ! (FYI, the latest benchmark failed, but it's normal. I forgot to disable py2 benchmarks after in the PR that removed support for Python 2 in install.py).

@JeanChristopheMorinPerso JeanChristopheMorinPerso merged commit 0e7ceb0 into AcademySoftwareFoundation:main Nov 17, 2023
27 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants