

@classmethod
def init_job(cls, mapreduce_state):
    'Initialize job-level writer state.\n\n    Args:\n      mapreduce_state: an instance of model.MapreduceState describing current\n      job.\n    '
    output_sharding = cls._get_output_sharding(mapreduce_state=mapreduce_state)
    if (output_sharding == cls.OUTPUT_SHARDING_INPUT_SHARDS):
        mapreduce_state.writer_state = cls._State([], []).to_json()
        return
    mapper_spec = mapreduce_state.mapreduce_spec.mapper
    params = _get_params(mapper_spec)
    mime_type = params.get('mime_type', 'application/octet-stream')
    filesystem = cls._get_filesystem(mapper_spec=mapper_spec)
    bucket = params.get(cls.GS_BUCKET_NAME_PARAM)
    acl = params.get(cls.GS_ACL_PARAM)
    filename = (((mapreduce_state.mapreduce_spec.name + '-') + mapreduce_state.mapreduce_spec.mapreduce_id) + '-output')
    if (bucket is not None):
        filename = ('%s/%s' % (bucket, filename))
    request_filenames = [filename]
    filenames = [cls._create_file(filesystem, filename, mime_type, acl=acl)]
    mapreduce_state.writer_state = cls._State(filenames, request_filenames).to_json()

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