Coverage for pySDC/implementations/hooks/log_restarts.py: 100%
6 statements
« prev ^ index » next coverage.py v7.6.7, created at 2024-11-16 14:51 +0000
« prev ^ index » next coverage.py v7.6.7, created at 2024-11-16 14:51 +0000
1from pySDC.core.hooks import Hooks
4class LogRestarts(Hooks):
5 """
6 Record restarts as `restart` at the beginning of the step.
7 """
9 def post_step(self, step, level_number):
10 """
11 Record here if the step was restarted.
13 Args:
14 step (pySDC.Step.step): Current step
15 level_number (int): Current level
16 """
17 super().post_step(step, level_number)
19 L = step.levels[level_number]
21 self.add_to_stats(
22 process=step.status.slot,
23 process_sweeper=L.sweep.rank,
24 time=L.time,
25 level=L.level_index,
26 iter=step.status.iter,
27 sweep=L.status.sweep,
28 type='restart',
29 value=int(step.status.get('restart')),
30 )