Open DominicOram opened 2 months ago
Some thoughts, let me know what you think...
I think detecting special cases where serialization is not needed adds some complexity, both to the code and to the UX. As you say we'd need a message for the user and to hope they read it when they're bashing their head against their plan wondering why this one specific parameter doesn't show up.
My preference in this case would be to not expose plan_b
to blueapi at all. The idea is that you expose plans that part of the "beamline API", i.e. the set of operations that take serializable parameters. Depending on what you've got in-concrete you might need to refactor into a 3rd plan to make it work.
It's possible we need more fine-grained control over which plans are exposed and which are not to achieve this, my initial, simple plan was that you'd just have a module where you put all the top-level API plans and put all the rest somewhere else. Or that you'd prefix your 3rd plan with an underscore.
I'm happy with that decision, can we change this issue to just be to document it somewhere?
On i04 we have two plans that we want GDA to be able to call (
plan_a
andplan_b
).plan_a
is basically a super-set ofplan_b
except we want to inject a bit of extra logic into the middle ofplan_b
. I tried to implement this as:However, I go the error of:
It's understandable that a
Callable
cannot be used in a pydantic model and supplied by GDA but I never need to supplysubplan
from GDA. This can be solved by refactoring into a 3rd plan that the two both call but we could also have a general rule of if an arg is optional and not serialiasable then do not worry about exposing it? Probably with a message to the user