def parse_mapreduce_yaml(contents):
 try:
  builder = yaml_object.ObjectBuilder(MapReduceYaml)
  handler = yaml_builder.BuilderHandler(builder)
  listener = yaml_listener.EventListener(handler)
  listener.Parse(contents)
  mr_info = handler.GetResults()
 except (ValueError, yaml_errors.EventError) as e:
  raise BadYamlError(e)
 if (len(mr_info) < 1):
  raise BadYamlError('No configs found in mapreduce.yaml')
 if (len(mr_info) > 1):
  raise MultipleDocumentsInMrYaml(('Found %d YAML documents' % len(mr_info)))
 jobs = mr_info[0]
 job_names = set((j.name for j in jobs.mapreduce))
 if (len(jobs.mapreduce) != len(job_names)):
  raise BadYamlError('Overlapping mapreduce names; names must be unique')
 return jobs

def parse_mapreduce_yaml ( contents ) : try : builder = yaml_object . ObjectBuilder ( MapReduceYaml ) handler = yaml_builder . BuilderHandler ( builder ) listener = yaml_listener . EventListener ( handler ) listener . Parse ( contents ) mr_info = handler . GetResults ( ) except ( ValueError , yaml_errors . EventError ) as e : raise BadYamlError ( e ) if ( len ( mr_info ) < 1 ) : raise BadYamlError ( 'No configs found in mapreduce.yaml' ) if ( len ( mr_info ) > 1 ) : raise MultipleDocumentsInMrYaml ( ( 'Found %d YAML documents' % len ( mr_info ) ) ) jobs = mr_info [ 0 ] job_names = set ( ( j . name for j in jobs . mapreduce ) ) if ( len ( jobs . mapreduce ) != len ( job_names ) ) : raise BadYamlError ( 'Overlapping mapreduce names; names must be unique' ) return jobs
parses mapreduce .