How to see the result of runtime inheritance

If you have a complex workflow it can be difficult to see at a glance exactly what settings a particular task ends up with through inheritance.

  • the cylc config command prints parsed settings after inheritance processing
  • the cylc graph command can show the runtime inheritance hierarchy, as well as the task graph

Example:

[scheduling]
    [[graph]]
        R1 = "foo => bar"
[runtime]
    [[root]]
        script = "echo my pet is a $PET"
        [[[environment]]]
            PET = "cat"
    [[FAM1]]
        [[[environment]]]
            PET = "dog"
    [[FAM2]]
        [[[environment]]]
            PET = "fish"
    [[FAM3]]
        inherit = FAM1, FAM2
        [[[environment]]]
            PET = "rock"
    [[foo]]
        inherit = FAM3
    [[bar]]
        inherit = FAM1, FAM2

Result:

$ cylc config . -i '[runtime][foo][environment]PET'
rock
$ cylc config . -i '[runtime][bar][environment]PET'
dog

And:

$ cylc graph -n .

graph-n

Note Cylc allows multiple inheritance - i.e. you can inherit from multiple families at once. To work out the result, we use the method resolution order algorithm from Python’s class inheritance model.

3 Likes

For a walk-through of inheritance in Cylc, see the inheritance tutorial:

https://cylc.github.io/cylc-doc/stable/html/tutorial/furthertopics/inheritance.html

A small follow-up.

You can use cylc list to see this:

$ cylc list --mro .
bar  bar FAM1 FAM2 root
foo  foo FAM3 FAM1 FAM2 root