Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swh-scrubber
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jérémy Bobbio (Lunar)
swh-scrubber
Commits
73eee4e3
Commit
73eee4e3
authored
2 years ago
by
Antoine Lambert
Browse files
Options
Downloads
Patches
Plain Diff
python: Reformat code with black 22.3.0
Related to T3922
parent
3dba5d83
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
swh/scrubber/cli.py
+9
-4
9 additions, 4 deletions
swh/scrubber/cli.py
swh/scrubber/db.py
+13
-3
13 additions, 3 deletions
swh/scrubber/db.py
swh/scrubber/storage_checker.py
+3
-1
3 additions, 1 deletion
swh/scrubber/storage_checker.py
with
25 additions
and
8 deletions
swh/scrubber/cli.py
+
9
−
4
View file @
73eee4e3
...
...
@@ -17,7 +17,10 @@ from swh.core.cli import swh as swh_cli_group
"
--config-file
"
,
"
-C
"
,
default
=
None
,
type
=
click
.
Path
(
exists
=
True
,
dir_okay
=
False
,),
type
=
click
.
Path
(
exists
=
True
,
dir_okay
=
False
,
),
help
=
"
Configuration file.
"
,
)
@click.pass_context
...
...
@@ -83,8 +86,7 @@ def scrubber_cli_group(ctx, config_file: Optional[str]) -> None:
@scrubber_cli_group.group
(
name
=
"
check
"
)
@click.pass_context
def
scrubber_check_cli_group
(
ctx
):
"""
group of commands which read from data stores and report errors.
"""
"""
group of commands which read from data stores and report errors.
"""
pass
...
...
@@ -140,7 +142,10 @@ def scrubber_check_journal(ctx) -> None:
from
.journal_checker
import
JournalChecker
checker
=
JournalChecker
(
db
=
ctx
.
obj
[
"
db
"
],
journal_client
=
conf
[
"
journal_client
"
],)
checker
=
JournalChecker
(
db
=
ctx
.
obj
[
"
db
"
],
journal_client
=
conf
[
"
journal_client
"
],
)
checker
.
run
()
...
...
This diff is collapsed.
Click to expand it.
swh/scrubber/db.py
+
13
−
3
View file @
73eee4e3
...
...
@@ -64,7 +64,10 @@ class ScrubberDb(BaseDb):
return
id_
def
corrupt_object_add
(
self
,
id
:
CoreSWHID
,
datastore
:
Datastore
,
serialized_object
:
bytes
,
self
,
id
:
CoreSWHID
,
datastore
:
Datastore
,
serialized_object
:
bytes
,
)
->
None
:
datastore_id
=
self
.
datastore_get_or_add
(
datastore
)
cur
=
self
.
cursor
()
...
...
@@ -121,7 +124,10 @@ class ScrubberDb(BaseDb):
return
results
def
corrupt_object_get
(
self
,
start_id
:
CoreSWHID
,
end_id
:
CoreSWHID
,
limit
:
int
=
100
,
self
,
start_id
:
CoreSWHID
,
end_id
:
CoreSWHID
,
limit
:
int
=
100
,
)
->
List
[
CorruptObject
]:
"""
Yields a page of records in the
'
corrupt_object
'
table, ordered by id.
...
...
@@ -182,7 +188,11 @@ class ScrubberDb(BaseDb):
LIMIT %(limit)s
FOR UPDATE SKIP LOCKED
"""
,
dict
(
start_id
=
str
(
start_id
),
end_id
=
str
(
end_id
),
limit
=
limit
,),
dict
(
start_id
=
str
(
start_id
),
end_id
=
str
(
end_id
),
limit
=
limit
,
),
)
return
self
.
_corrupt_object_list_from_cursor
(
cur
)
...
...
This diff is collapsed.
Click to expand it.
swh/scrubber/storage_checker.py
+
3
−
1
View file @
73eee4e3
...
...
@@ -55,7 +55,9 @@ class StorageChecker:
if
isinstance
(
self
.
storage
,
PostgresqlStorage
):
with
storage_db
(
self
.
storage
)
as
db
:
self
.
_datastore
=
Datastore
(
package
=
"
storage
"
,
cls
=
"
postgresql
"
,
instance
=
db
.
conn
.
dsn
,
package
=
"
storage
"
,
cls
=
"
postgresql
"
,
instance
=
db
.
conn
.
dsn
,
)
else
:
raise
NotImplementedError
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment