-
Notifications
You must be signed in to change notification settings - Fork 335
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
add CustomPackageOrder #355
base: main
Are you sure you want to change the base?
add CustomPackageOrder #355
Conversation
Cheers Paul, this sounds good. I have a question. I actually need an orderer where you can specify a The reason I want this orderer: I've found there are common misconceptions Thanks, On Thu, Oct 13, 2016 at 10:53 PM, Paul Molodowitch <[email protected]
|
Yeah, you should be able to do this. The strings given the the orderer are package_orderers = [ (...or, of course, if you wanted EXACTLY 3-or-lower, and didn't want things This would give you your [3, 2, 1, 5, 4] order because the orderer will by ['<4']
On Mon, Oct 31, 2016 at 2:59 PM allan johns [email protected] Cheers Paul, this sounds good. I have a question. I actually need an orderer where you can specify a The reason I want this orderer: I've found there are common misconceptions Thanks, On Thu, Oct 13, 2016 at 10:53 PM, Paul Molodowitch <[email protected]
— |
Actually, after re-reading your use case, it sounds like you'd want to use This does bring up something which I've thought in the past would be nice, foo<3.* Last note - in your case, since you're creating an orderer programatically, On Wed, Nov 2, 2016 at 4:31 PM, Paul Molodowitch [email protected] wrote:
|
ae3882b
to
a56b876
Compare
Completely rebased to apply against the latest master, and cleaned up a bit too! The first two commits are bugfixes, which are also included in the "orderer_fixes" pull request (#413) |
Do you have an example of an actual use case for this? In what scenario would a package want to use non-standard versioning to order packages as opposed to using a standardized versioning scheme? |
It's not about versioning-ordering, per-se, but solver-prioritization. That is, this doesn't affect which versions are considered greater than others at all (and as such, I now realize my comment, referencing this PR in this thread #302 doesn't apply). As a real-world example, you may want the solver to "prefer" maya-2016 over maya-2017, even though maya-2017 is still considered greater. So, if someone requested rez-env maya>2016 ..then they would still end up with maya-2017 (or maya-2016.5), since it's "greater" than 2016. However, if they just requested: rez-env maya ...then you might want to have it resolve to maya-2016, because that version is "prioritized". That's exactly the use case we have at Luma most of the time - where we just want to have a studio-wide "default" version of something. However, this also allows us to get even more granular, and say things like, "We prefer version 2016 over 2017, and within 2016, we prefer service pack 2 over service pack 3... but we prefer 2017 over 2015... and within 2017, we prefer service pack 4 over service pack 5". |
Ah, I see now. We use a similar concept of "preferred versions", though we define them in curated "environment" packages. For example, we have a package called It sounds like what you're looking for is environment management. The old documentation explicitly made the distinction between package management and environment management and how rez was really just a platform to build environment management on top off. I'm not sure why it was left out of the newer docs. |
Allan already incorporated the concept of configurable package-prioritization into rez - check out package_order.py. I'm simply extending this work (by making it configurable through rezconfig, adding a new orderer, and fixing some bugs). |
I'll give a completely different but also real-world example that we're
using at Method.
We used to manage envs by baking out contexts, but in the long run that's
proved too much of a bottleneck and people would often 'patch' in order to
circumvent this and get more recent packages. So instead we've switched to
a runtime solve type approach, where the env is resolved when you launch
the tool.
This causes another problem though - we also don't want the latest of every
package each time a tool is launched, because that is too unstable. So, we
had to figure out an approach that gives the best of both worlds -
stability where we want it, but also the ability to selectively accept
latest packages.
One approach is to do the runtime resolve, but use a rez timestamp. That's
not great though because it doesn't allow for exceptions... for eg if you
use a timestamp set to tuesday 4am, no packages past that time are visible,
even if a show specifically wants a new patch of something. In this sense,
this isn't much better than contexts.
To solve this, we use a 'soft timestamp' package orderer. It works like
this: You specify a timestamp, and rez will prefer packages released before
that time... however, it _will_ also see newer packages (unlike the
'timestamp' feature, which hides them).
The end result of this is that we can specify that we don't want "packages
since tuesday 4am", however if a user (or 'profile' - config files that
define the env package request) explicitly asks for packages newer than
that timestamp, that also works.
Hth
A
…On Tue, Apr 4, 2017 at 5:56 AM, Paul Molodowitch ***@***.***> wrote:
Allan already incorporated the concept of configurable
package-prioritization into rez - check out package_order.py. I'm simply
extending this work (by making it configurable through rezconfig, adding a
new orderer, and fixing some bugs).
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#355 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABjqSp9w_T9VZdJYbyESt60zXO7ctVvOks5rsU7tgaJpZM4KWd2O>
.
|
Thanks for the explanation.
This is also the way I've been using rez.
Isn't this the entire purpose of using explicit versions in a package manager? Instead of specifying bare package dependencies, like It seems like what you're actually trying to do is environment management (i.e. for Lighting, I need these packages and versions). But instead of specifying the "preferred" versions in the "Lighting" environment, you're specifying those "preferred" versions in the packages themselves and never really explicitly defining the "Lighting" environment. To me, the "preferred" version is subjective depending on the environment, and shouldn't be an attribute of the package. |
Below..
On Tue, Apr 4, 2017 at 8:28 AM, Brendan Abel ***@***.***> wrote:
Thanks for the explanation.
So instead we've switched to a runtime solve type approach, where the env
is resolved when you launch the tool.
This is also the way I've been using rez.
This causes another problem though - we also don't want the latest of every
package each time a tool is launched, because that is too unstable.
Isn't this the entire purpose of using explicit versions in a package
manager? Instead of specifying bare package dependencies, like mypackage,
shouldn't you be launching tools using more explicit versions, like
mypackage-1.5? That way, you automatically pick up "bugfix" releases
(i.e. mypackage-1.5.2), but for minor releases, they won't automatically
be pushed out to production until you manually update the launcher
environment to use mypackage-1.6.
Yes, but there are usually loads of packages that the packages you directly
require depend on, that you might not know or care about. Getting the
latest of these can cause instability.
It seems like what you're actually trying to do is *environment
management* (i.e. for Lighting, I need *these* packages and versions).
But instead of specifying the "preferred" versions in the "Lighting"
environment, you're specifying those "preferred" versions in the packages
themselves and never really explicitly defining the "Lighting" environment.
Not sure what you mean. Package order is not specified in packages. Our
packages definitely define only their true requirements, unrelated to
specific production needs.
To me, the "preferred" version is subjective depending on the environment,
and shouldn't be an attribute of the package.
Perhaps there's a misunderstanding, these are not attributes of the package.
Our 'soft' timestamp orderer is configured separately to packages (we have
a config, overridable per-show, that controls this). It just causes rez to
have an affinity for packages released before a given time, but also obeys
any explicit requests for packages in the profile (the profile is the
config listing the package versions you want). That way the user has full
control, but we also avoid pulling in latest of secondary package
dependencies (such as internal pipeline libraries).
Hth
A
… —
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#355 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABjqSkzYNKLZoLCNaPgihJnuZDo7efSIks5rsXKGgaJpZM4KWd2O>
.
|
Yes, I thought this was a setting for packages.
So, are you using rez config files as the primary way of defining different environments? In your configs, do you have a soft timestamp defined for each of your packages, or is it a global timestamp that affects the preferred version of all packages? When you want to push out the latest releases, do you just update the timestamps in your config files? I'd be interested to see what one of your config files looks like. Perhaps there is a simpler way to push out changes than what I am doing. |
We use config files to define environments, they aren't rez configs (we
have a layer that sits above rez). We have a soft timestamp defined
globally, but it can be overridden per show. We can also specify
package-specific soft timestamps in this same config (for eg we may decide
that latest of some anim package is fine).
The system supports cron-like syntax for the soft timestamp, and we have it
set to 4am tue,wed,thu (or something like that). Package releases are
completely independent of this - if there's a new release of package X,
shows won't get it til say, 4am Thursday. If they need it sooner, they can
update their profile(s) to get this newer version earlier on (we can also
do this on tool cli, eg "mytool ++patch somelib-3.0.0").
A profile is very simple btw, it's just something like:
requires:
maya-2017
maya_utils-1.2+<2
We typically have one per app, although sometimes we bundle multiple small
utility tools into single profiles.
A separate 'lock' file controls soft timestamps and it looks something like:
package:
timestamp: * 4 * * tue,wed,thu
Hth
A
…On Tue, Apr 4, 2017 at 9:43 AM, Brendan Abel ***@***.***> wrote:
Perhaps there's a misunderstanding, these are not attributes of the
package.
Yes, I thought this was a setting for packages.
Our 'soft' timestamp orderer is configured separately to packages (we have
a config, overridable per-show, that controls this)
So, are you using rez config files as the primary way of defining
different environments? In your configs, do you have a soft timestamp
defined for each of your packages, or is it a global timestamp that affects
the preferred version of all packages? When you want to push out the latest
releases, do you just update the timestamps in your config files? I'd be
interested to see what one of your config files looks like. Perhaps there
is a simpler way to push out changes than what I am doing.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#355 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABjqShLPSonvlpmLt4-ZtzZ-EQj5Jdzbks5rsYQSgaJpZM4KWd2O>
.
|
I'm looking to address this exact issue, but I'm having trouble figuring out how to actually use the existing I'm digging through the source, and found a unit test for it, but it doesn't actually test it in-context with where it's used, but rather tests the individual features unit-test style. Would it be possible to provide a short example? |
I think i would handle such a "default" on the context/request side rather than in the solver. Another possibility would be to set a package filter to filter our 2017 (that can be overriden in the shell if you absolutely want it). But again, i would say that this is to be solved before sending your request. |
So... this PR is now way out of date, and would probably need to be heavily refactored to get it to work with current source... but, we're going to need to update our internal version of rez at some point, and I'd LOVE to see it merged in. Once it was, you would configure it in rezconfig.py. Here's an example:
The version expressions in the custom orderer use standard rez version range syntax, and are listed in order from most preferred to least preferred (with all other unmatching versions coming at the end). This would mean that for foo, you would:
Within a specified version range, normal version ordering takes place - so, for instance, the exact version that exist for foo are:
...then the full ordered version preference for foo would be:
Note also that the inclusion of the "version_split" orderer was simply to demonstrate how to include multiple orderers. You could easily have included those in the "custom" orderer by doing:
|
Thanks @elrond79! Was it possible to also use |
@mottosso - sadly, no. I believe the first commit in this PR addressed the configuration issue. |
Fixes #369.
This adds a new package orderer, which allows the user to specify and explicit ordering for versions in the package, using standard version-range strings. It also provides an easy way to specify a "default" version. See the docstring for CustomPackageOrder for more details.
The first commit adds the ability to configure which orderers you want using the standard rezconfig mechanisms; the last also adds a ReversePackageOrder, which does exactly what you'd think it does. ;)