Open prjemian opened 3 years ago
Perhaps the bluesky.preprocessors.contingency_wrapper()
(on which the @contingency_decorator
is based)?
The contingency_wrapper()
provides a try..except..else..finally
structure to intercept anticipated problems and call configured handlers in each case.
Recovering from Exceptions involves decisions that can be dependent on the current impact of the exception and the plan's ability to resolve. Such as, if an EpicsSignal becomes disconnected, should the plan wait, ignore the problem, or stop?
resolve in FAQ per https://github.com/BCDA-APS/bluesky_training/issues/183
Advice today on slack.com from Daniel Allan (danielballan, NSLS-II):
Start here https://blueskyproject.io/bluesky/tutorial.html#plan-cleanup-exception-handling
Which mentions https://blueskyproject.io/bluesky/generated/bluesky.preprocessors.finalize_wrapper.html#bluesky.preprocessors.finalize_wrapper
From the "See also" consider https://blueskyproject.io/bluesky/generated/bluesky.preprocessors.contingency_wrapper.html#bluesky.preprocessors.contingency_wrapper which is one notch more complex and more powerful
There is also https://github.com/bluesky/bluesky/blob/e38b2dab394300fff1cc02fbc5bd2fba23cbfdc1/bluesky/preprocessors.py#L1091 (which also has a decorator form) that will do the book keeping and resetting for you
This content never made it into a HOWTO document. These issues/PRs are related:
Good for a notebook.