Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
StorageLeaf
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
ProjectLeaf
StorageLeaf
Commits
ce8985eb
Commit
ce8985eb
authored
3 years ago
by
Robert Goldmann
Browse files
Options
Downloads
Patches
Plain Diff
#9 - new route for manually triggering the cleanup
parent
de8b84b4
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/logic/database/Schemas.py
+6
-0
6 additions, 0 deletions
src/logic/database/Schemas.py
src/logic/routers/GeneralRouter.py
+18
-0
18 additions, 0 deletions
src/logic/routers/GeneralRouter.py
with
24 additions
and
0 deletions
src/logic/database/Schemas.py
+
6
−
0
View file @
ce8985eb
...
@@ -38,6 +38,12 @@ class DatabaseInfo(BaseModel):
...
@@ -38,6 +38,12 @@ class DatabaseInfo(BaseModel):
}
}
class
DatabaseCleanupInfo
(
BaseModel
):
before
:
DatabaseInfo
after
:
DatabaseInfo
difference
:
DatabaseInfo
class
MinMax
(
BaseModel
):
class
MinMax
(
BaseModel
):
min
:
float
=
None
min
:
float
=
None
max
:
float
=
None
max
:
float
=
None
...
...
This diff is collapsed.
Click to expand it.
src/logic/routers/GeneralRouter.py
+
18
−
0
View file @
ce8985eb
...
@@ -23,3 +23,21 @@ async def version():
...
@@ -23,3 +23,21 @@ async def version():
response_model
=
Schemas
.
DatabaseInfo
)
response_model
=
Schemas
.
DatabaseInfo
)
async
def
databaseInfo
(
db
:
Session
=
Depends
(
get_database
)):
async
def
databaseInfo
(
db
:
Session
=
Depends
(
get_database
)):
return
DatabaseInfoProvider
.
get_database_info
(
db
)
return
DatabaseInfoProvider
.
get_database_info
(
db
)
@router.get
(
'
/databaseCleanup
'
,
summary
=
'
Cleans up the database by enforcing the configured retention policies
'
,
response_model
=
Schemas
.
DatabaseCleanupInfo
)
async
def
databaseCleanup
(
db
:
Session
=
Depends
(
get_database
)):
infoBefore
=
DatabaseInfoProvider
.
get_database_info
(
db
)
# TODO
infoAfter
=
DatabaseInfoProvider
.
get_database_info
(
db
)
deletedMeasurements
=
infoBefore
.
number_of_measurements
-
infoAfter
.
number_of_measurements
sizeFreed
=
infoBefore
.
size_on_disk_in_mb
-
infoAfter
.
size_on_disk_in_mb
infoDifference
=
Schemas
.
DatabaseInfo
(
number_of_measurements
=
deletedMeasurements
,
size_on_disk_in_mb
=
sizeFreed
)
return
Schemas
.
DatabaseCleanupInfo
(
before
=
infoBefore
,
after
=
infoAfter
,
difference
=
infoDifference
)
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