User Tools


This is an old revision of the document!


YAML Formatting Script

This script takes in a dumped parameter server and a file to overwrite with new values. It uses a yaml parser that keeps ordering and comments intact on read and write.

Usage

If you ever forget the usage of the script use ./yaml_format -h. The script will also give the help if a parameter is missing.

The basic usage is to dump the parameter server to a know location and to run the script. The script takes 2 inputs, the dumped parameter server and the file to overwrite with the values from the parameter server. The --input (-i also works) parameter is the parameter server file and the --output (-i also works) parameter is the file to overwrite in this case. For example:

./yaml_format -i paramdump.yaml -o control.yaml

This will read in the control.yaml file into a data structure in the script and do the same for the paramdump.yaml file. Then the script will loop over the paramdump.yaml file and check if each key value pair exists in the file. If the pair exists in control.yaml it will be updated with the new value from paramdump.yaml. This method ensures that random pairs aren't added to control.yaml.

Another usage of the script is to clean up a messy yaml file. This is done by making a copy of the yaml file and then running a command similar to the following:

./yaml_format -i params_cpy.yaml -o params.yaml