@@ -226,7 +226,7 @@ Start by creating a strategy skeleton:
226226 import attr
227227
228228 from labgrid.step import step
229- from labgrid.strategy import Strategy, StrategyError
229+ from labgrid.strategy import Strategy, StrategyError, never_retry
230230 from labgrid.factory import target_factory
231231
232232 class Status(enum.Enum):
@@ -239,6 +239,7 @@ Start by creating a strategy skeleton:
239239
240240 status = attr.ib(default=Status.unknown)
241241
242+ @never_retry
242243 @step()
243244 def transition(self, status, *, step):
244245 if not isinstance(status, Status):
@@ -262,9 +263,21 @@ It is possible to reference drivers via their protocol, e.g.
262263Note that drivers which implement multiple protocols must not be referenced
263264multiple times via different protocols.
264265The ``Status `` class needs to be extended to cover the states of your strategy,
265- then for each state an ``elif `` entry in the transition function needs to be
266+ then for each state an ``elif `` entry in the `` transition() `` method needs to be
266267added.
267268
269+ .. note ::
270+ Since infrastructure failures or broken strategies typically cannot recover,
271+ it makes little sense to continue operating with such a strategy after an
272+ error has occurred.
273+ To clearly mark a strategy as unusable after failure (and to avoid cascading
274+ errors in subsequent calls) the strategy's ``transition() `` method (and
275+ optionally its ``force() `` method) can be decorated with the
276+ ``@never_retry `` decorator.
277+ This decorator causes the strategy to store the encountered exception in its
278+ ``broken `` attribute and raise a ``StrategyError `` for the original and all
279+ subsequent calls to the decorated methods.
280+
268281Lets take a look at the builtin `BareboxStrategy `.
269282The Status enum for the BareboxStrategy:
270283
0 commit comments