import shutil


def concatenate_job(job, input_ids):
    """This job just concatenates the input files together and returns them."""
    out_path = job.fileStore.getLocalTempFile()
    with open(out_path, 'w') as output:
        for input_id in input_ids:
            input_path = job.fileStore.readGlobalFile(input_id)
            with open(input_path) as input:
                shutil.copyfileobj(input, output)
    return job.fileStore.writeGlobalFile(out_path)