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

Fixed pipeline hook execution order may break existing workaround code #3012

Closed
vkarak opened this issue Oct 5, 2023 · 0 comments · Fixed by #3083
Closed

Fixed pipeline hook execution order may break existing workaround code #3012

vkarak opened this issue Oct 5, 2023 · 0 comments · Fixed by #3083

Comments

@vkarak
Copy link
Contributor

vkarak commented Oct 5, 2023

The fix #2997 may break existing code used to workaround this limitation in previous versions. More specifically, the following example will fail to run with reframe >= 4.3.4

class my_base_test(...):
    x = variable(int)

    @run_before('run')
    def use_x(self):
        y = self.x

@rfm.simple_test
class my_test(my_base_test):
    @run_before('run')
    def set_x(self):
        self.x = 1

    # Possible workaround for reframe <= 4.3.3
    @run_before('run')
    def use_x(self):
        super().use_x()

Affected versions: >= 4.3.4

How to fix

If you are using reframe >= 4.4, you should pin the base class hook to run last it its stage:

class my_base_test(...):
    x = variable(int)

    @run_before('run', always_last=True)
    def use_x(self):
        y = self.x

@rfm.simple_test
class my_test(my_base_test):
    @run_before('run')
    def set_x(self):
        self.x = 1

For reframe 4.3.4 specifically, where the always_last argument is not available, you should rewrite the initial workaround as

class my_base_test(...):
    x = variable(int)

    @run_before('run')
    def use_x(self):
        y = self.x

@rfm.simple_test
class my_test(my_base_test):
    @run_before('run')
    def use_x(self):
        self.x = 1
        super().use_x()

We should add a note about this in the docs and also review the current docs/tutorials on their hook syntax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment