'Converts a MapReduceYaml file into a JSON-encodable dictionary.
For use in user-visible UI and internal methods for interfacing with
user code (like param validation). as a list
Args:
mapreduce_yaml: The Pyton representation of the mapreduce.yaml document.
Returns:
A list of configuration dictionaries.'

@staticmethod
def to_dict(mapreduce_yaml):

    all_configs = []
    for config in mapreduce_yaml.mapreduce:
        out = {'name': config.name, 'mapper_input_reader': config.mapper.input_reader, 'mapper_handler': config.mapper.handler}
        if config.mapper.params_validator:
            out['mapper_params_validator'] = config.mapper.params_validator
        if config.mapper.params:
            param_defaults = {}
            for param in config.mapper.params:
                param_defaults[param.name] = (param.default or param.value)
            out['mapper_params'] = param_defaults
        if config.params:
            param_defaults = {}
            for param in config.params:
                param_defaults[param.name] = (param.default or param.value)
            out['params'] = param_defaults
        all_configs.append(out)
    return all_configs
