def run_after(stage): '''Attach the decorated function after a certain pipeline stage. This is analogous to :func:`~RegressionMixin.run_before`, except that the hook will execute right after the stage it was attached to. This decorator also supports ``'init'`` as a valid ``stage`` argument, where in this case, the hook will execute right after the test is initialized (i.e. after the :func:`__init__` method is called) and before entering the test's pipeline. In essence, a post-init hook is equivalent to defining additional :func:`__init__` functions in the test. The following code .. code-block:: python class MyTest(rfm.RegressionTest): @run_after('init') def foo(self): self.x = 1 is equivalent to .. code-block:: python class MyTest(rfm.RegressionTest): def __init__(self): self.x = 1 .. versionchanged:: 3.5.2 Add support for post-init hooks. ''' return hooks.attach_to('post_' + stage)
def run_after(stage): '''Decorator for attaching a test method to a pipeline stage. .. deprecated:: 3.7.0 Please use the :func:`~reframe.core.pipeline.RegressionMixin.run_after` built-in function. ''' warn.user_deprecation_warning( 'using the @rfm.run_after decorator from the rfm module is ' 'deprecated; please use the built-in decorator @run_after instead.', from_version='3.7.0' ) if stage not in _USER_PIPELINE_STAGES: raise ReframeSyntaxError( f'invalid pipeline stage specified: {stage!r}') # Map user stage names to the actual pipeline functions if needed if stage == 'init': stage = '__init__' elif stage == 'compile': stage = 'compile_wait' elif stage == 'run': stage = 'run_wait' return hooks.attach_to('post_' + stage)
def run_before(stage): '''Attach the decorated function before a certain pipeline stage. The function will run just before the specified pipeline stage and it cannot accept any arguments except ``self``. This decorator can be stacked, in which case the function will be attached to multiple pipeline stages. See above for the valid ``stage`` argument values. :param stage: The pipeline stage where this function will be attached to. See :ref:`pipeline-hooks` for the list of valid stage values. ''' return hooks.attach_to('pre_' + stage)
def run_before(stage): '''Decorator for attaching a test method to a pipeline stage. See online docs for more information. ''' if stage not in _USER_PIPELINE_STAGES: raise ValueError( f'invalid pipeline stage specified: {stage!r}') if stage == 'init': raise ValueError('pre-init hooks are not allowed') return hooks.attach_to('pre_' + stage)
def run_after(stage): '''Decorator for attaching a test method to a pipeline stage. See online docs for more information. ''' if stage not in _USER_PIPELINE_STAGES: raise ValueError( f'invalid pipeline stage specified: {stage!r}') # Map user stage names to the actual pipeline functions if needed if stage == 'init': stage = '__init__' elif stage == 'compile': stage = 'compile_wait' elif stage == 'run': stage = 'run_wait' return hooks.attach_to('post_' + stage)
def run_before(stage): '''Decorator for attaching a test method to a pipeline stage. .. deprecated:: 3.7.0 Please use the :func:`~reframe.core.pipeline.RegressionMixin.run_before` built-in function. ''' warn.user_deprecation_warning( 'using the @rfm.run_before decorator from the rfm module is ' 'deprecated; please use the built-in decorator @run_before instead.', from_version='3.7.0') if stage not in _USER_PIPELINE_STAGES: raise ReframeSyntaxError( f'invalid pipeline stage specified: {stage!r}') if stage == 'init': raise ReframeSyntaxError('pre-init hooks are not allowed') return hooks.attach_to('pre_' + stage)
def run_after(stage): '''Decorator for attaching a test method to a given stage. See online docs for more information. ''' return hooks.attach_to('post_' + stage)