This is an automated email from the ASF dual-hosted git repository. github-bot pushed a commit to branch raoul/802-refactor-artifactcache in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit c69d12f9aa89b15e2ea489419907cc66c4b70450 Author: Raoul Hidalgo Charman <[email protected]> AuthorDate: Fri Dec 7 17:29:21 2018 +0000 _cas: Rename artifactcache folder and move that to a root module Other components will start to reply on cas modules, and not the artifact cache modules so it should be organized to reflect this. All relevant imports have been changed. Part #802 --- .../artifactcache.py => _artifactcache.py} | 16 ++++++++-------- buildstream/{_artifactcache => _cas}/__init__.py | 2 +- buildstream/{_artifactcache => _cas}/cascache.py | 0 buildstream/{_artifactcache => _cas}/casserver.py | 0 buildstream/_context.py | 2 +- buildstream/sandbox/_sandboxremote.py | 2 +- doc/source/using_configuring_artifact_server.rst | 2 +- tests/artifactcache/config.py | 3 +-- tests/artifactcache/expiry.py | 4 ++-- tests/sandboxes/storage-tests.py | 2 +- tests/storage/virtual_directory_import.py | 2 +- tests/testutils/artifactshare.py | 4 ++-- tests/utils/misc.py | 2 +- 13 files changed, 20 insertions(+), 21 deletions(-) diff --git a/buildstream/_artifactcache/artifactcache.py b/buildstream/_artifactcache.py similarity index 99% rename from buildstream/_artifactcache/artifactcache.py rename to buildstream/_artifactcache.py index b4b8df3..1b2b55d 100644 --- a/buildstream/_artifactcache/artifactcache.py +++ b/buildstream/_artifactcache.py @@ -23,14 +23,14 @@ import signal import string from collections.abc import Mapping -from ..types import _KeyStrength -from .._exceptions import ArtifactError, CASError, LoadError, LoadErrorReason -from .._message import Message, MessageType -from .. import _signals -from .. import utils -from .. import _yaml - -from .cascache import CASRemote, CASRemoteSpec +from .types import _KeyStrength +from ._exceptions import ArtifactError, CASError, LoadError, LoadErrorReason +from ._message import Message, MessageType +from . import _signals +from . import utils +from . import _yaml + +from ._cas import CASRemote, CASRemoteSpec CACHE_SIZE_FILE = "cache_size" diff --git a/buildstream/_artifactcache/__init__.py b/buildstream/_cas/__init__.py similarity index 91% rename from buildstream/_artifactcache/__init__.py rename to buildstream/_cas/__init__.py index fad483a..7386109 100644 --- a/buildstream/_artifactcache/__init__.py +++ b/buildstream/_cas/__init__.py @@ -17,4 +17,4 @@ # Authors: # Tristan Van Berkom <[email protected]> -from .artifactcache import ArtifactCache, ArtifactCacheSpec, CACHE_SIZE_FILE +from .cascache import CASCache, CASRemote, CASRemoteSpec diff --git a/buildstream/_artifactcache/cascache.py b/buildstream/_cas/cascache.py similarity index 100% rename from buildstream/_artifactcache/cascache.py rename to buildstream/_cas/cascache.py diff --git a/buildstream/_artifactcache/casserver.py b/buildstream/_cas/casserver.py similarity index 100% rename from buildstream/_artifactcache/casserver.py rename to buildstream/_cas/casserver.py diff --git a/buildstream/_context.py b/buildstream/_context.py index c62755c..324b455 100644 --- a/buildstream/_context.py +++ b/buildstream/_context.py @@ -31,7 +31,7 @@ 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.cascache import CASCache +from ._cas import CASCache from ._workspaces import Workspaces, WorkspaceProjectCache, WORKSPACE_PROJECT_FILE from .plugin import _plugin_lookup from .sandbox import SandboxRemote diff --git a/buildstream/sandbox/_sandboxremote.py b/buildstream/sandbox/_sandboxremote.py index a842f08..8b4c87c 100644 --- a/buildstream/sandbox/_sandboxremote.py +++ b/buildstream/sandbox/_sandboxremote.py @@ -38,7 +38,7 @@ from .._protos.google.rpc import code_pb2 from .._exceptions import SandboxError from .. import _yaml from .._protos.google.longrunning import operations_pb2, operations_pb2_grpc -from .._artifactcache.cascache import CASRemote, CASRemoteSpec +from .._cas import CASRemote, CASRemoteSpec class RemoteExecutionSpec(namedtuple('RemoteExecutionSpec', 'exec_service storage_service action_service')): diff --git a/doc/source/using_configuring_artifact_server.rst b/doc/source/using_configuring_artifact_server.rst index cc4880e..bcf7d0e 100644 --- a/doc/source/using_configuring_artifact_server.rst +++ b/doc/source/using_configuring_artifact_server.rst @@ -94,7 +94,7 @@ requiring BuildStream's more exigent dependencies by setting the Command reference ~~~~~~~~~~~~~~~~~ -.. click:: buildstream._artifactcache.casserver:server_main +.. click:: buildstream._cas.casserver:server_main :prog: bst-artifact-server diff --git a/tests/artifactcache/config.py b/tests/artifactcache/config.py index df40d10..8c8c4b4 100644 --- a/tests/artifactcache/config.py +++ b/tests/artifactcache/config.py @@ -3,8 +3,7 @@ import pytest import itertools import os -from buildstream._artifactcache import ArtifactCacheSpec -from buildstream._artifactcache.artifactcache import _configured_remote_artifact_cache_specs +from buildstream._artifactcache import ArtifactCacheSpec, _configured_remote_artifact_cache_specs from buildstream._context import Context from buildstream._project import Project from buildstream.utils import _deduplicate diff --git a/tests/artifactcache/expiry.py b/tests/artifactcache/expiry.py index 05cbe32..e739283 100644 --- a/tests/artifactcache/expiry.py +++ b/tests/artifactcache/expiry.py @@ -342,13 +342,13 @@ def test_invalid_cache_quota(cli, datafiles, tmpdir, quota, success): total_space = 10000 volume_space_patch = mock.patch( - "buildstream._artifactcache.artifactcache.ArtifactCache._get_volume_space_info_for", + "buildstream._artifactcache.ArtifactCache._get_volume_space_info_for", autospec=True, return_value=(free_space, total_space), ) cache_size_patch = mock.patch( - "buildstream._artifactcache.artifactcache.ArtifactCache.get_cache_size", + "buildstream._artifactcache.ArtifactCache.get_cache_size", autospec=True, return_value=0, ) diff --git a/tests/sandboxes/storage-tests.py b/tests/sandboxes/storage-tests.py index e646a62..3871677 100644 --- a/tests/sandboxes/storage-tests.py +++ b/tests/sandboxes/storage-tests.py @@ -3,7 +3,7 @@ import pytest from buildstream._exceptions import ErrorDomain -from buildstream._artifactcache.cascache import CASCache +from buildstream._cas import CASCache from buildstream.storage._casbaseddirectory import CasBasedDirectory from buildstream.storage._filebaseddirectory import FileBasedDirectory diff --git a/tests/storage/virtual_directory_import.py b/tests/storage/virtual_directory_import.py index fa40b17..0bb47e3 100644 --- a/tests/storage/virtual_directory_import.py +++ b/tests/storage/virtual_directory_import.py @@ -8,7 +8,7 @@ from tests.testutils import cli from buildstream.storage._casbaseddirectory import CasBasedDirectory from buildstream.storage._filebaseddirectory import FileBasedDirectory from buildstream._artifactcache import ArtifactCache -from buildstream._artifactcache.cascache import CASCache +from buildstream._cas import CASCache from buildstream import utils diff --git a/tests/testutils/artifactshare.py b/tests/testutils/artifactshare.py index 38c54a9..6b03d8d 100644 --- a/tests/testutils/artifactshare.py +++ b/tests/testutils/artifactshare.py @@ -11,8 +11,8 @@ from multiprocessing import Process, Queue import pytest_cov from buildstream import _yaml -from buildstream._artifactcache.cascache import CASCache -from buildstream._artifactcache.casserver import create_server +from buildstream._cas import CASCache +from buildstream._cas.casserver import create_server from buildstream._exceptions import CASError from buildstream._protos.build.bazel.remote.execution.v2 import remote_execution_pb2 diff --git a/tests/utils/misc.py b/tests/utils/misc.py index 4ab29ad..a34d3cd 100644 --- a/tests/utils/misc.py +++ b/tests/utils/misc.py @@ -23,7 +23,7 @@ def test_parse_size_over_1024T(cli, tmpdir): _yaml.dump({'name': 'main'}, str(project.join("project.conf"))) volume_space_patch = mock.patch( - "buildstream._artifactcache.artifactcache.ArtifactCache._get_volume_space_info_for", + "buildstream._artifactcache.ArtifactCache._get_volume_space_info_for", autospec=True, return_value=(1025 * TiB, 1025 * TiB) )
