def PerformMapReduce(input_gcs, output_gcs,
                     mapper_type, mapper_url, mapper_file, mapper_count,
                     reducer_type, reducer_url, reducer_file, reducer_count):
  SCRIPT_DIRECTORY = '/tmp/hadoop_package/hadoop_scripts'
  tmpdir = tempfile.mkdtemp(prefix='hadoop-mr-')
  os.chmod(tmpdir, 0755)

  yield '==== MapReduce ====\n'

  try:
    if not input_gcs:
      raise InvalidMapReduceParameter('Input should not be empty')
    if not output_gcs:
      raise InvalidMapReduceParameter('Output should not be empty')

    input_gcs = 'gs://' + input_gcs
    output_gcs = 'gs://' + output_gcs

    # Remove trailing '/'
    if input_gcs[-1] == '/':
      input_gcs = input_gcs[:-1]
    if output_gcs[-1] == '/':
      output_gcs = output_gcs[:-1]

    yield 'Input: %s\n' % input_gcs
    yield 'Output: %s\n' % output_gcs

    yield 'Mapper type: %s\n' % mapper_type
    if mapper_type == 'url':
      yield 'Mapper URL: %s\n' % mapper_url
    yield 'Mapper count: %d\n' % mapper_count
    yield 'Reducer type: %s\n' % reducer_type
    if reducer_type == 'url':
      yield 'Reducer URL: %s\n' % reducer_url
    yield 'Reducer count: %d\n' % reducer_count

    mapper_local = SetUpMapperOrReducer(
        'mapper', mapper_type, mapper_url, mapper_file, tmpdir)
    reducer_local = SetUpMapperOrReducer(
        'reducer', reducer_type, reducer_url, reducer_file, tmpdir)
  except (FileError, InvalidMapReduceParameter) as e:
    yield '\n'
    yield 'ERROR: %s\n' % str(e)
    yield '\n'
    yield 'ERROR: Cannot start MapReduce\n'
    return

  command = [
      'sudo -u hadoop',
      os.path.join(SCRIPT_DIRECTORY, 'mapreduce__at__master.sh'),
      mapper_local, str(mapper_count), reducer_local, str(reducer_count),
      input_gcs, output_gcs]

  command_concatenated = ' '.join(command)
  yield 'MapReduce command: %s\n' % command_concatenated

  mapreduce_process = subprocess.Popen(
      command_concatenated, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
      shell=True)
  while True:
    line = mapreduce_process.stdout.readline()
    if not line:
      break
    yield line

  if mapreduce_process.returncode:
    yield '\n'
    yield ('ERROR: MapReduce process finished with %d\n' %
           mapreduce_process.returncode)
  else:
    yield 'MapReduce finished\n'
    yield '------------------\n'
Returns the given variable's definition.
dataset/ETHPy150Open GoogleCloudPlatform/Data-Pipeline/app/static/hadoop_scripts/rpc_daemon/__main__.py/PerformMapReduce--crossover with--dataset/ETHPy150Open google/openhtf/openhtf/plugs/usb/fastboot_protocol.py/FastbootCommands.Getvar