CI jobs failing with AttributeError: 'Query' object has no attribute 'with_lockmode' with sqlalchemy 1.4.18

Bug #1933226 reported by yatin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
watcher
Fix Released
Undecided
Unassigned

Bug Description

with sqlalchemy-1.4.18 jobs fails with below Traceback:-
Jun 17 08:32:30.978350 ubuntu-focal-inap-mtl01-0025156859 watcher-applier[156509]: ERROR apscheduler.executors.default Traceback (most recent call last):
Jun 17 08:32:30.978350 ubuntu-focal-inap-mtl01-0025156859 watcher-applier[156509]: ERROR apscheduler.executors.default File "/usr/local/lib/python3.8/dist-packages/apscheduler/executors/base.py", line 125, in run_job
Jun 17 08:32:30.978350 ubuntu-focal-inap-mtl01-0025156859 watcher-applier[156509]: ERROR apscheduler.executors.default retval = job.func(*job.args, **job.kwargs)
Jun 17 08:32:30.978350 ubuntu-focal-inap-mtl01-0025156859 watcher-applier[156509]: ERROR apscheduler.executors.default File "/opt/stack/watcher/watcher/common/service.py", line 124, in send_beat
Jun 17 08:32:30.978350 ubuntu-focal-inap-mtl01-0025156859 watcher-applier[156509]: ERROR apscheduler.executors.default watcher_service.save()
Jun 17 08:32:30.978350 ubuntu-focal-inap-mtl01-0025156859 watcher-applier[156509]: ERROR apscheduler.executors.default File "/usr/local/lib/python3.8/dist-packages/oslo_versionedobjects/base.py", line 226, in wrapper
Jun 17 08:32:30.978350 ubuntu-focal-inap-mtl01-0025156859 watcher-applier[156509]: ERROR apscheduler.executors.default return fn(self, *args, **kwargs)
Jun 17 08:32:30.978350 ubuntu-focal-inap-mtl01-0025156859 watcher-applier[156509]: ERROR apscheduler.executors.default File "/opt/stack/watcher/watcher/objects/service.py", line 122, in save
Jun 17 08:32:30.978350 ubuntu-focal-inap-mtl01-0025156859 watcher-applier[156509]: ERROR apscheduler.executors.default db_obj = self.dbapi.update_service(self.id, updates)
Jun 17 08:32:30.978350 ubuntu-focal-inap-mtl01-0025156859 watcher-applier[156509]: ERROR apscheduler.executors.default File "/opt/stack/watcher/watcher/db/sqlalchemy/api.py", line 1094, in update_service
Jun 17 08:32:30.978350 ubuntu-focal-inap-mtl01-0025156859 watcher-applier[156509]: ERROR apscheduler.executors.default return self._update(models.Service, service_id, values)
Jun 17 08:32:30.978350 ubuntu-focal-inap-mtl01-0025156859 watcher-applier[156509]: ERROR apscheduler.executors.default File "/opt/stack/watcher/watcher/db/sqlalchemy/api.py", line 281, in _update
Jun 17 08:32:30.978350 ubuntu-focal-inap-mtl01-0025156859 watcher-applier[156509]: ERROR apscheduler.executors.default ref = query.with_lockmode('update').one()
Jun 17 08:32:30.978350 ubuntu-focal-inap-mtl01-0025156859 watcher-applier[156509]: ERROR apscheduler.executors.default AttributeError: 'Query' object has no attribute 'with_lockmode'

Example logs:- https://0152cc80754598f7dd6e-579ffa891605f8b01745396aeb7b7fcc.ssl.cf2.rackcdn.com/796781/1/check/watcher-tempest-actuator/b406bdd/controller/logs/screen-watcher-applier.txt

Also seen while updating sqlalchemy to 1.4.18 in RDO https://review.rdoproject.org/r/c/rdoinfo/+/34221.

logs:- https://logserver.rdoproject.org/21/34221/3/check/validate-buildsys-tags-xena-testing-puppet-scenario004-centos8/053d856/logs/weirdo-project/logs/watcher/watcher.txt.gz

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to watcher (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/watcher/+/797889

Changed in watcher:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to watcher (master)

Reviewed: https://review.opendev.org/c/openstack/watcher/+/797889
Committed: https://opendev.org/openstack/watcher/commit/9ca44fa3ab16ba99c65b75c7fa2fde3b2c160b1d
Submitter: "Zuul (22348)"
Branch: master

commit 9ca44fa3ab16ba99c65b75c7fa2fde3b2c160b1d
Author: ericxiett <eric_xiett@163.com>
Date: Thu Jun 24 12:27:05 2021 +0000

    Replace deprecated with_lockmode with with_for_update

    The Query.with_lockmode() method is deprecated since version 0.9.0
    and will be removed in a future release. [1]
    This patch replaces it with Query.with_for_update().
    The 'faultstring' was been modified to 'Exactly 5 or 6 columns has to be
    specified for iterator expression', so adds one space between "iterator"
    and "expression" for 'expected_error_msg'.

    Also use upper-constraints in doc build to avoid issues in pdf build.

    [1]
    https://docs.sqlalchemy.org/en/13/orm/query.html#sqlalchemy.orm.query.Query.with_lockmode

    Closes-Bug: #1933226
    Change-Id: I0ad514da647bb08790259fd27e56a41f6dbbbaa0

Changed in watcher:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to watcher (stable/wallaby)

Fix proposed to branch: stable/wallaby
Review: https://review.opendev.org/c/openstack/watcher/+/798883

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to watcher (stable/wallaby)

Reviewed: https://review.opendev.org/c/openstack/watcher/+/798883
Committed: https://opendev.org/openstack/watcher/commit/281455a08a4c2606f887f9ce3fe3cd30af6333f7
Submitter: "Zuul (22348)"
Branch: stable/wallaby

commit 281455a08a4c2606f887f9ce3fe3cd30af6333f7
Author: ericxiett <eric_xiett@163.com>
Date: Thu Jun 24 12:27:05 2021 +0000

    Replace deprecated with_lockmode with with_for_update

    The Query.with_lockmode() method is deprecated since version 0.9.0
    and will be removed in a future release. [1]
    This patch replaces it with Query.with_for_update().
    The 'faultstring' was been modified to 'Exactly 5 or 6 columns has to be
    specified for iterator expression', so adds one space between "iterator"
    and "expression" for 'expected_error_msg'.

    Also use upper-constraints in doc build to avoid issues in pdf build.

    [1]
    https://docs.sqlalchemy.org/en/13/orm/query.html#sqlalchemy.orm.query.Query.with_lockmode

    Closes-Bug: #1933226
    Change-Id: I0ad514da647bb08790259fd27e56a41f6dbbbaa0
    (cherry picked from commit 9ca44fa3ab16ba99c65b75c7fa2fde3b2c160b1d)

tags: added: in-stable-wallaby
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/watcher 7.0.0.0rc1

This issue was fixed in the openstack/watcher 7.0.0.0rc1 release candidate.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/watcher 6.0.1

This issue was fixed in the openstack/watcher 6.0.1 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.