diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2019-01-20 14:37:41 -0500 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2019-04-14 16:54:30 +0900 |
commit | fa606120b827ed92f310f3832c0362848650d6a6 (patch) | |
tree | bc67f91762bb47d485286aa443282b8920be97eb | |
parent | 5cd5797df00528c063dd58337c0f51c3329d5d65 (diff) | |
download | buildstream-fa606120b827ed92f310f3832c0362848650d6a6.tar.gz |
_context.py: Added get_artifact_cache_usage()
A frontend facing API for obtaining usage statistics.
I would have put this on Stream instead, but the Context
seems to be the de facto place for looking up the artifact cache
in general so let's put it here.
-rw-r--r-- | buildstream/_context.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/buildstream/_context.py b/buildstream/_context.py index b536161e4..997b82959 100644 --- a/buildstream/_context.py +++ b/buildstream/_context.py @@ -29,7 +29,7 @@ from . import _yaml from ._exceptions import LoadError, LoadErrorReason, BstError from ._message import Message, MessageType from ._profile import Topics, profile_start, profile_end -from ._artifactcache import ArtifactCache +from ._artifactcache import ArtifactCache, ArtifactCacheUsage from ._artifactcache.cascache import CASCache from ._workspaces import Workspaces from .plugin import Plugin @@ -237,6 +237,16 @@ class Context(): return self._artifactcache + # get_artifact_cache_usage() + # + # Fetches the current usage of the artifact cache + # + # Returns: + # (ArtifactCacheUsage): The current status + # + def get_artifact_cache_usage(self): + return ArtifactCacheUsage(self.artifactcache) + # add_project(): # # Add a project to the context. |