

@classmethod
def finalize_job(cls, mapreduce_state):
    'Finalize job-level writer state.\n\n    Collect from model.ShardState if this job has output per shard.\n\n    Args:\n      mapreduce_state: an instance of model.MapreduceState describing current\n      job.\n    '
    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()

dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/ext/mapreduce/output_writers.py FileOutputWriterBase.finalize_job/original