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-01-24 13:02:08 -0500 |
commit | 353293b6c5bcbe7d65d95a3a484b2d7c739e74ac (patch) | |
tree | 93ede7fc8b606f4494aab2fe43c1a1e9f4008bb7 | |
parent | 7ee0c579d5c6c2e3f4a70f80e3414a03d3a18cca (diff) | |
download | buildstream-353293b6c5bcbe7d65d95a3a484b2d7c739e74ac.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 f14f6b746..29a016065 100644 --- a/buildstream/_context.py +++ b/buildstream/_context.py @@ -30,7 +30,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 ._cas import CASCache from ._workspaces import Workspaces, WorkspaceProjectCache from .plugin import _plugin_lookup @@ -289,6 +289,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. |