epics-containers / ibek

IOC Builder for EPICS and Kubernetes
https://epics-containers.github.io/ibek
Apache License 2.0
12 stars 4 forks source link

Document order of execution of Jinja Expressions #220

Open gilesknap opened 5 months ago

gilesknap commented 5 months ago

This needs adding to the docs as an essential guide to how your yaml gets turned into runtime assets.

That's it! (phew!). Although this reads as complicated it is essentially just saying everything happens top to bottom of the yaml.

UPDATE: Caveat: Values are always evalutated after Args - this might be an issue. Maybe we need a PreValues and a PostValues to support the Technosoft axis number field??

GDYendell commented 5 months ago

entities that have no id are not available to Jinja at this stage

What defines whether an Entity has an id or not?

gilesknap commented 5 months ago

entities that have no id are not available to Jinja at this stage

What defines whether an Entity has an id or not?

You define an id with an Arg like this:

You only need to make an ID if you want to refer to the thing from another entity.

GDYendell commented 5 months ago

I think that is going to be a common point of confusion, so should have a very clear explanation and maybe some examples of defining and referencing

gilesknap commented 4 months ago

Jinja rendering of parameters / defines now all happens in the Entity model validator during IOC instance deserialisation.

https://github.com/epics-containers/ibek/blob/list-arg2dict-param/src/ibek/ioc.py#L97-L122

The second phase of jinja rendering of pre_init, post_init, databases happens in ioc_commands.generate.

I have a good handle on the order of jinja rendering and it is relatively intuitive. Just need to write it up.