@transactional_session
def touch_replica(replica, session=None):
    "\n    Update the accessed_at timestamp of the given file replica/did but don't wait if row is locked.\n\n    :param replica: a dictionary with the information of the affected replica.\n    :param session: The database session in use.\n\n    :returns: True, if successful, False otherwise.\n    "
    try:
        (accessed_at, none_value) = ((replica.get('accessed_at') or datetime.utcnow()), None)
        session.query(models.RSEFileAssociation).filter_by(rse_id=replica['rse_id'], scope=replica['scope'], name=replica['name']).with_hint(models.RSEFileAssociation, 'index(REPLICAS REPLICAS_PK)', 'oracle').with_for_update(nowait=True).one()
        session.query(models.RSEFileAssociation).filter_by(rse_id=replica['rse_id'], scope=replica['scope'], name=replica['name']).with_hint(models.RSEFileAssociation, 'index(REPLICAS REPLICAS_PK)', 'oracle').update({'accessed_at': accessed_at, 'tombstone': case([(and_((models.RSEFileAssociation.tombstone != none_value), (models.RSEFileAssociation.tombstone != OBSOLETE)), accessed_at)], else_=models.RSEFileAssociation.tombstone)}, synchronize_session=False)
        session.query(models.DataIdentifier).filter_by(scope=replica['scope'], name=replica['name'], did_type=DIDType.FILE).with_hint(models.DataIdentifier, 'INDEX(DIDS DIDS_PK)', 'oracle').with_for_update(nowait=True).one()
        session.query(models.DataIdentifier).filter_by(scope=replica['scope'], name=replica['name'], did_type=DIDType.FILE).with_hint(models.DataIdentifier, 'INDEX(DIDS DIDS_PK)', 'oracle').update({'accessed_at': accessed_at}, synchronize_session=False)
    except DatabaseError:
        return False
    except NoResultFound:
        return True
    return True
Update the accessed_at timestamp of the given file replica/did but don't wait if row is locked.

:param replica: a dictionary with the information of the affected replica.
:param session: The database session in use.

:returns: True, if successful, False otherwise.
@transactional_session
def touch_replica(replica, session=None):
    "\n    Update the accessed_at timestamp of the given file replica/did but don't wait if row is locked.\n\n    :param replica: a dictionary with the information of the affected replica.\n    :param session: The database session in use.\n\n    :returns: True, if successful, False otherwise.\n    "
    try:
        (accessed_at, none_value) = ((replica.get('accessed_at') or datetime.utcnow()), None)
        session.query(models.RSEFileAssociation).filter_by(rse_id=replica['rse_id'], scope=replica['scope'], name=replica['name']).with_hint(models.RSEFileAssociation, 'index(REPLICAS REPLICAS_PK)', 'oracle').with_for_update(nowait=True).one()
        session.query(models.RSEFileAssociation).filter_by(rse_id=replica['rse_id'], scope=replica['scope'], name=replica['name']).with_hint(models.RSEFileAssociation, 'index(REPLICAS REPLICAS_PK)', 'oracle').update({'accessed_at': accessed_at, 'tombstone': case([(and_((models.RSEFileAssociation.tombstone != none_value), (models.RSEFileAssociation.tombstone != OBSOLETE)), accessed_at)], else_=models.RSEFileAssociation.tombstone)}, synchronize_session=False)
        session.query(models.DataIdentifier).filter_by(scope=replica['scope'], name=replica['name'], did_type=DIDType.FILE).with_hint(models.DataIdentifier, 'INDEX(DIDS DIDS_PK)', 'oracle').with_for_update(nowait=True).one()
        session.query(models.DataIdentifier).filter_by(scope=replica['scope'], name=replica['name'], did_type=DIDType.FILE).with_hint(models.DataIdentifier, 'INDEX(DIDS DIDS_PK)', 'oracle').update({'accessed_at': accessed_at}, synchronize_session=False)
    except DatabaseError:
        return False
    except NoResultFound:
        return True
    return True