How to get the flags (key, value) pairs into a json object?
StarWang opened this issue · 2 comments
StarWang commented
Hi dev team,
How do we get the (key, value) mapping from FLAGS if we want to save them?
yilei commented
There is some lightweight serialization / deserialization support:
- To save, use
FLAGS.append_flags_into_file()
orFLAGS.flags_into_string()
for serialization of all flags - To restore, specify
--flagfile=<somefile>
on the command line pointing to a file containing the above content, or callFLAGS.read_flags_from_files(['--flagfile=<somefile>'])
If you really need json, you'll need to do it manually. Take a look at
abseil-py/absl/flags/_flagvalues.py
Lines 1183 to 1190 in 06edd9c
Hope this helps.
yilei commented
Closing due to inactivity. Feel free to reopen if you still have questions.