simple-framework / simple_grid_yaml_compiler

Generates the extended YAML output for an input site_level_configuration_file
Apache License 2.0
0 stars 9 forks source link

Control ordering in yaml.load #8

Closed maany closed 6 years ago

maany commented 6 years ago

For default values to be correctly assigned, it is important to parse the yaml files to python dicts in correct order. (variables need to be declared before they can be used)

ruamel seems to do the trick: https://stackoverflow.com/questions/13297744/pyyaml-control-ordering-of-items-called-by-yaml-load

maany commented 6 years ago

Added ruamel. Linked commits: https://github.com/WLCG-Lightweight-Sites/wlcg_lightweight_site_wn_pbs/commit/72c0a72e3a5f28d08427c88b81ea699e79497c2d

https://github.com/WLCG-Lightweight-Sites/wlcg_lightweight_site_ce_cream/commit/9864e2ca4bfd6d527cc1a970b9ba1c5680b11141

Python Dict cannot contain two same keys. This is also what YAML specification states. So, the default-data files in WN and CE need the modifications shown.

The code in this issue also adapts the compiler to work with the changes in the repositories