コード例 #1
0
ファイル: api.py プロジェクト: dennybaa/mistral
def acquire_lock(model, id, session=None):
    if b.get_driver_name() != "sqlite":
        query = _secure_query(model).filter("id = '%s'" % id)

        query.update({"updated_at": timeutils.utcnow()}, synchronize_session="fetch")
    else:
        sqlite_lock.acquire_lock(id, session)
コード例 #2
0
    def _run_acquire_release_sqlite_lock(self, obj_id, session):
        self._random_sleep()

        sqlite_lock.acquire_lock(obj_id, session)

        self._random_sleep()

        sqlite_lock.release_locks(session)
コード例 #3
0
ファイル: test_locking.py プロジェクト: openstack/mistral
    def _run_acquire_release_sqlite_lock(self, obj_id, session):
        self._random_sleep()

        sqlite_lock.acquire_lock(obj_id, session)

        self._random_sleep()

        sqlite_lock.release_locks(session)
コード例 #4
0
ファイル: api.py プロジェクト: anilyadav/mistral
def acquire_lock(model, id, session=None):
    # Expire all so all objects queried after lock is acquired
    # will be up-to-date from the DB and not from cache.
    session.expire_all()

    if b.get_driver_name() == 'sqlite':
        # In case of 'sqlite' we need to apply a manual lock.
        sqlite_lock.acquire_lock(id, session)

    return _lock_entity(model, id)
コード例 #5
0
def acquire_lock(model, id, session=None):
    # Expire all so all objects queried after lock is acquired
    # will be up-to-date from the DB and not from cache.
    session.expire_all()

    if b.get_driver_name() == 'sqlite':
        # In case of 'sqlite' we need to apply a manual lock.
        sqlite_lock.acquire_lock(id, session)

    return _lock_entity(model, id)
コード例 #6
0
def acquire_lock(model, id, session=None):
    if b.get_driver_name() != 'sqlite':
        query = _secure_query(model).filter("id = '%s'" % id)

        query.update(
            {'updated_at': timeutils.utcnow()},
            synchronize_session='fetch',
        )
    else:
        sqlite_lock.acquire_lock(id, session)
コード例 #7
0
ファイル: api.py プロジェクト: gs-spadmanabhan/mistral
def acquire_lock(model, id, session=None):
    # Expire all so all objects queried after lock is acquired
    # will be up-to-date from the DB and not from cache.
    session.expire_all()

    if b.get_driver_name() != 'sqlite':
        entity = _get_one_entity(model, id)
        entity.update({'updated_at': timeutils.utcnow()})

    else:
        sqlite_lock.acquire_lock(id, session)
        entity = _get_one_entity(model, id)

    return entity
コード例 #8
0
ファイル: api.py プロジェクト: gs-spadmanabhan/mistral
def acquire_lock(model, id, session=None):
    # Expire all so all objects queried after lock is acquired
    # will be up-to-date from the DB and not from cache.
    session.expire_all()

    if b.get_driver_name() != 'sqlite':
        entity = _get_one_entity(model, id)
        entity.update({'updated_at': timeutils.utcnow()})

    else:
        sqlite_lock.acquire_lock(id, session)
        entity = _get_one_entity(model, id)

    return entity