Skip to content

Conversation

@vkarak
Copy link
Contributor

@vkarak vkarak commented Oct 27, 2022

This practically extends on the field aliasing that we used to have and brings the same concept to variables. Users can now define a variable as an alias of another one. This is quite useful for transitional periods and deprecations when a variable is renamed. An aliased can be defined as follows:

x = variable(int, value=3)
y = variable(alias=x)

The variable y may not have a default value, but it can be independently loggable. Any update of variable x will be visible to y and vice versa. Aliased variables can refer also to inherited variables.

This feature is useful for transitional periods when a variable is renamed and a deprecation is introduced and we want to keep both names for a while. The new variable can also be wrapped with deprecate() to mark a deprecation. This allows us to introduces variable aliases and deprecations effortlessly.

This commit also introduces implementation improvements on how variables are inherited. In particular, inherited variables are no more set redundantly as they are being inherited by classes lower in the hierarchy.

This practically extends on the field aliasing that we used to have and brings
the same concept to variables. Users can now define a variable as an alias of
another one. This is quite useful for transitional periods and deprecations when
a variable is renamed.

This commit also introduces implementation improvements on how variables are
inherited.
Copy link
Contributor

@victorusu victorusu left a comment

Choose a reason for hiding this comment

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

lgtm

@victorusu
Copy link
Contributor

@teojgo and @ekouts, could you please take a look at this PR?

Copy link
Contributor

@teojgo teojgo left a comment

Choose a reason for hiding this comment

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

lgtm, I only have a question. Is the null string the default one when the alias is not loggable? I couldn't find where it comes from

@vkarak
Copy link
Contributor Author

vkarak commented Nov 3, 2022

lgtm, I only have a question. Is the null string the default one when the alias is not loggable? I couldn't find where it comes from

The alias get their default value from their target. See the _default_value property.

@ekouts
Copy link
Contributor

ekouts commented Nov 4, 2022

@jenkins-cscs retry all

@teojgo
Copy link
Contributor

teojgo commented Nov 4, 2022

lgtm, I only have a question. Is the null string the default one when the alias is not loggable? I couldn't find where it comes from

The alias get their default value from their target. See the _default_value property.

Ok, yeah it was difficult to find where the null comes from because in the end it comes from the json.dumps.

@vkarak vkarak merged commit f19875f into reframe-hpc:master Nov 4, 2022
@vkarak vkarak deleted the feat/variable-aliases branch November 4, 2022 23:06
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.

4 participants