Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
buildstream
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
Container registry
Model registry
Operate
Environments
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
Privacy statement
Keyboard shortcuts
?
What's new
6
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
BuildStream
buildstream
Commits
f93b0420
Commit
f93b0420
authored
6 years ago
by
Tristan Van Berkom
Browse files
Options
Downloads
Patches
Plain Diff
_artifactcache.py: Added client progress callback to ArtifactCache.clean()
parent
78340e80
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
buildstream/_artifactcache.py
+12
-1
12 additions, 1 deletion
buildstream/_artifactcache.py
with
12 additions
and
1 deletion
buildstream/_artifactcache.py
+
12
−
1
View file @
f93b0420
...
...
@@ -250,10 +250,13 @@ class ArtifactCache():
#
# Clean the artifact cache as much as possible.
#
# Args:
# progress (callable): A callback to call when a ref is removed
#
# Returns:
# (int): The size of the cache after having cleaned up
#
def
clean
(
self
):
def
clean
(
self
,
progress
=
None
):
artifacts
=
self
.
list_artifacts
()
context
=
self
.
context
...
...
@@ -332,6 +335,14 @@ class ArtifactCache():
# Remove the size from the removed size
self
.
set_cache_size
(
self
.
_cache_size
-
size
)
# User callback
#
# Currently this process is fairly slow, but we should
# think about throttling this progress() callback if this
# becomes too intense.
if
progress
:
progress
()
# Informational message about the side effects of the cleanup
self
.
_message
(
MessageType
.
INFO
,
"
Cleanup completed
"
,
detail
=
(
"
Removed {} refs and saving {} disk space.
\n
"
+
...
...
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