'When upload to bigquery fails, write to AFF4.'

def _WriteToAFF4(self, job_id, schema, gzip_filehandle_parent, token):

    with self._CreateOutputStream('.'.join((job_id, 'schema'))) as schema_stream:
        logging.error('Upload    to    bigquery    failed,    will    write    schema    to    %s', schema_stream.urn)
        if (schema_stream.size == 0):
            schema_stream.write(json.dumps(schema))
    with self._CreateOutputStream('.'.join((job_id, 'data'))) as data_stream:
        logging.error('Upload    to    bigquery    failed,    will    write    results    to    %s', data_stream.urn)
        gzip_filehandle_parent.flush()
        gzip_filehandle_parent.seek(0)
        for line in gzip_filehandle_parent:
            data_stream.write(line)
