Bug 1361661 - Part 1: Generate headers with process data from Processes.yaml. r=dexter

Adding the Gecko enums to Processes.yaml allows us to generate mappings from ProcessID to GeckoProcessType.
We generate string tables with the Telemetry process names, so we can use these names consistently throughout Telemetry.
This commit is contained in:
Georg Fritzsche
2017-05-22 15:33:29 +07:00
parent f25e20b208
commit d49123af6e
6 changed files with 173 additions and 1 deletions

View File

@@ -8,6 +8,7 @@
from __future__ import print_function
import re
import yaml
# This is a list of flags that determine which process a measurement is allowed
# to record from.
@@ -130,3 +131,15 @@ def add_expiration_postfix(expiration):
return expiration + "a1"
return expiration
def load_yaml_file(filename):
""" Load a YAML file from disk, throw a ParserError on failure."""
try:
with open(filename, 'r') as f:
return yaml.safe_load(f)
except IOError, e:
raise ParserError('Error opening ' + filename + ': ' + e.message)
except ValueError, e:
raise ParserError('Error parsing processes in {}: {}'
.format(filename, e.message))