BCDA-APS / bluesky_training

Bluesky training, including instrument package
https://bcda-aps.github.io/bluesky_training/
Other
11 stars 0 forks source link

How does the RE reset things if a scan is stopped early. How to configure reset/cleanup? #22

Open prjemian opened 3 years ago

prjemian commented 3 years ago

Good for a notebook.

prjemian commented 2 years ago

Perhaps the bluesky.preprocessors.contingency_wrapper() (on which the @contingency_decorator is based)?

prjemian commented 1 year ago

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?

prjemian commented 1 year ago

https://github.com/BCDA-APS/bluesky_training/issues/183

prjemian commented 1 year ago

resolve in FAQ per https://github.com/BCDA-APS/bluesky_training/issues/183

prjemian commented 1 year ago

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

prjemian commented 1 year ago

This content never made it into a HOWTO document. These issues/PRs are related: