did.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:rucio 作者: rucio01 项目源码 文件源码
def touch_dids(dids, session=None):
    """
    Update the accessed_at timestamp of the given dids.

    :param replicas: the list of dids.
    :param session: The database session in use.

    :returns: True, if successful, False otherwise.
    """

    now = datetime.utcnow()
    try:
        for did in dids:
            session.query(models.DataIdentifier).filter_by(scope=did['scope'], name=did['name'], did_type=did['type']).\
                update({'accessed_at': did.get('accessed_at') or now}, synchronize_session=False)
    except DatabaseError:
        return False

    return True
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号