Skip to content
Snippets Groups Projects
Commit ce84885e authored by Tristan Van Berkom's avatar Tristan Van Berkom
Browse files

_artifactcache.py: Added client progress callback to ArtifactCache.clean()

parent 38884367
No related branches found
No related tags found
No related merge requests found
......@@ -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
......@@ -327,6 +330,10 @@ class ArtifactCache():
# Remove the size from the removed size
self.set_cache_size(self._cache_size - size)
# User callback
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" +
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment