@classmethod
  def finalize_job(cls, mapreduce_state):
    state = cls._State.from_json(mapreduce_state.writer_state)
    output_sharding = cls._get_output_sharding(mapreduce_state=mapreduce_state)
    filesystem = cls._get_filesystem(mapreduce_state.mapreduce_spec.mapper)
    if output_sharding != cls.OUTPUT_SHARDING_INPUT_SHARDS:
      files.finalize(state.filenames[0])
      finalized_filenames = [cls._get_finalized_filename(
          filesystem, state.filenames[0], state.request_filenames[0])]
    else:
      shards = model.ShardState.find_by_mapreduce_state(mapreduce_state)
      finalized_filenames = []
      for shard in shards:
        state = cls._State.from_json(shard.writer_state)
        finalized_filenames.append(state.filenames[0])

    state.filenames = finalized_filenames
    state.request_filenames = []
    mapreduce_state.writer_state = state.to_json()
Finalize job-level writer state.
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/ext/mapreduce/output_writers.py/FileOutputWriterBase.finalize_job