Page MenuHomeSoftware Heritage

cli.db: Use attribute current_version instead of undeclared getter
ClosedPublic

Authored by ardumont on May 30 2022, 4:43 PM.

Details

Summary

I have no idea why both exist. But this centralized one (current_version) is declared on
most swh modules vs the other method which is not [2]

[1]

$SWH_ENVIRONMENT_HOME/swh-indexer/swh/indexer/storage/db.py:    current_version = 133
$SWH_ENVIRONMENT_HOME/swh-scheduler/swh/scheduler/backend.py:    current_version = 33
$SWH_ENVIRONMENT_HOME/swh-scrubber/swh/scrubber/db.py:    current_version = 2
$SWH_ENVIRONMENT_HOME/swh-storage/swh/storage/postgresql/db.py:    current_version = 182
$SWH_ENVIRONMENT_HOME/swh-vault/swh/vault/backend.py:    current_version = 4

[2]

grep -r "get_current_version(" $SWH_ENVIRONMENT_HOME/*/swh/
$SWH_ENVIRONMENT_HOME/swh-indexer/swh/indexer/storage/__init__.py:    def get_current_version(self, *, db=None, cur=None):
$SWH_ENVIRONMENT_HOME/swh-scheduler/swh/scheduler/backend.py:    def get_current_version(self):
$SWH_ENVIRONMENT_HOME/swh-storage/swh/storage/postgresql/storage.py:    def get_current_version(self, *, db: Db, cur=None):

Related to T4284
Supersedes D7906

Test Plan

Patched on scrubber0.staging and now the cli works! [1]

[1]

swhworker@scrubber0:~$ swh db --config-file config.yml version scrubber
module: scrubber
current code version: 2
version: 1

Diff Detail

Repository
rDCORE Foundations and core functionalities
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build has FAILED

Patch application report for D7907 (id=28511)

Rebasing onto f18016af5c...

Current branch diff-target is up to date.
Changes applied before test
commit c52516feac901aa72cce833bdd9d06ebb01bfd52
Author: Antoine R. Dumont (@ardumont) <antoine.romain.dumont@gmail.com>
Date:   Mon May 30 16:14:06 2022 +0200

    cli.db: Use attribute current_version instead of undeclared getter
    
    Related to T4284

Link to build: https://jenkins.softwareheritage.org/job/DCORE/job/tests-on-diff/430/
See console output for more information: https://jenkins.softwareheritage.org/job/DCORE/job/tests-on-diff/430/console

Harbormaster returned this revision to the author for changes because remote builds failed.May 30 2022, 4:45 PM
Harbormaster failed remote builds in B29601: Diff 28511!

Build is green

Patch application report for D7907 (id=28513)

Rebasing onto f18016af5c...

Current branch diff-target is up to date.
Changes applied before test
commit 5cda0ca626010cccc7e7f3f73fbfb1b20702ac40
Author: Antoine R. Dumont (@ardumont) <antoine.romain.dumont@gmail.com>
Date:   Mon May 30 16:14:06 2022 +0200

    cli.db: Use attribute current_version instead of undeclared getter
    
    Related to T4284

See https://jenkins.softwareheritage.org/job/DCORE/job/tests-on-diff/431/ for more details.

This revision is now accepted and ready to land.May 30 2022, 5:04 PM