@transactional_session
def delete_replicas(rse_id, files, ignore_availability=True, session=None):
    '\n    Delete file replicas.\n\n    :param rse_id: the rse id.\n    :param files: the list of files to delete.\n    :param ignore_availability: Ignore the RSE blocklisting.\n    :param session: The database session in use.\n    '
    replica_rse = get_rse(rse_id=rse_id, session=session)
    if ((not (replica_rse.availability & 1)) and (not ignore_availability)):
        raise exception.ResourceTemporaryUnavailable(('%s is temporary unavailablefor deleting' % replica_rse.rse))
    (replica_condition, src_condition) = ([], [])
    for file in files:
        replica_condition.append(and_((models.RSEFileAssociation.scope == file['scope']), (models.RSEFileAssociation.name == file['name'])))
        src_condition.append(and_((models.Source.scope == file['scope']), (models.Source.name == file['name']), (models.Source.rse_id == rse_id)))
    (delta, bytes, rowcount) = (0, 0, 0)
    for chunk in chunks(src_condition, 10):
        rowcount = session.query(models.Source).filter(or_(*chunk)).delete(synchronize_session=False)
    rowcount = 0
    for chunk in chunks(replica_condition, 10):
        for (scope, name, rid, replica_bytes) in session.query(models.RSEFileAssociation.scope, models.RSEFileAssociation.name, models.RSEFileAssociation.rse_id, models.RSEFileAssociation.bytes).with_hint(models.RSEFileAssociation, 'INDEX(REPLICAS REPLICAS_PK)', 'oracle').filter((models.RSEFileAssociation.rse_id == rse_id)).filter(or_(*chunk)):
            bytes += replica_bytes
            delta += 1
        rowcount += session.query(models.RSEFileAssociation).filter((models.RSEFileAssociation.rse_id == rse_id)).filter(or_(*chunk)).delete(synchronize_session=False)
    if (rowcount != len(files)):
        raise exception.ReplicaNotFound("One or several replicas don't exist.")
    __cleanup_after_replica_deletion(rse_id=rse_id, files=files, session=session)
    decrease(rse_id=rse_id, files=delta, bytes=bytes, session=session)
Delete file replicas.

:param rse_id: the rse id.
:param files: the list of files to delete.
:param ignore_availability: Ignore the RSE blocklisting.
:param session: The database session in use.
@transactional_session
def delete_replicas(rse_id, files, ignore_availability=True, session=None):
    '\n    Delete file replicas.\n\n    :param rse_id: the rse id.\n    :param files: the list of files to delete.\n    :param ignore_availability: Ignore the RSE blocklisting.\n    :param session: The database session in use.\n    '
    replica_rse = get_rse(rse_id=rse_id, session=session)
    if ((not (replica_rse.availability & 1)) and (not ignore_availability)):
        raise exception.ResourceTemporaryUnavailable(('%s is temporary unavailablefor deleting' % replica_rse.rse))
    (replica_condition, src_condition) = ([], [])
    for file in files:
        replica_condition.append(and_((models.RSEFileAssociation.scope == file['scope']), (models.RSEFileAssociation.name == file['name'])))
        src_condition.append(and_((models.Source.scope == file['scope']), (models.Source.name == file['name']), (models.Source.rse_id == rse_id)))
    (delta, bytes, rowcount) = (0, 0, 0)
    for chunk in chunks(src_condition, 10):
        rowcount = session.query(models.Source).filter(or_(*chunk)).delete(synchronize_session=False)
    rowcount = 0
    for chunk in chunks(replica_condition, 10):
        for (scope, name, rid, replica_bytes) in session.query(models.RSEFileAssociation.scope, models.RSEFileAssociation.name, models.RSEFileAssociation.rse_id, models.RSEFileAssociation.bytes).with_hint(models.RSEFileAssociation, 'INDEX(REPLICAS REPLICAS_PK)', 'oracle').filter((models.RSEFileAssociation.rse_id == rse_id)).filter(or_(*chunk)):
            bytes += replica_bytes
            delta += 1
        rowcount += session.query(models.RSEFileAssociation).filter((models.RSEFileAssociation.rse_id == rse_id)).filter(or_(*chunk)).delete(synchronize_session=False)
    if (rowcount != len(files)):
        raise exception.ReplicaNotFound("One or several replicas don't exist.")
    __cleanup_after_replica_deletion(rse_id=rse_id, files=files, session=session)
    decrease(rse_id=rse_id, files=delta, bytes=bytes, session=session)