From 75ae932b147bba1f296e8f5dfbc6e01fbca8c21b Mon Sep 17 00:00:00 2001 From: MarleneKress79789 Date: Wed, 10 Nov 2021 10:47:12 +0100 Subject: [PATCH 1/2] #46: Moved BucketFs Location to bucketfs-utils-python --- .../udfs/combine_to_voting_regressor_udf.py | 4 +- .../partial_fit_regression_training_runner.py | 4 +- .../udfs/partial_fit_regressor_udf.py | 2 +- .../model_utils/udfs/predict_regressor_udf.py | 2 +- .../model_utils/udfs/score_regressor_udf.py | 2 +- .../udf_utils/abstract_bucketfs_location.py | 30 ---------- .../udf_utils/bucketfs_factory.py | 53 ------------------ .../udf_utils/bucketfs_location.py | 56 ------------------- .../localfs_mock_bucketfs_location.py | 47 ---------------- .../test_bucketfs_location.py | 43 -------------- tests/integration_tests/test_train_udf.py | 2 +- .../test_combine_to_voting_regressor_udf.py | 4 +- .../udfs/test_partial_fit_regressor_udf.py | 2 +- .../udfs/test_predict_regressor_udf.py | 2 +- .../udfs/test_score_regressor_udf.py | 3 +- .../udf_utils/test_bucketfs_factory.py | 36 ------------ .../test_localfs_mock_bucketfs_location.py | 33 ----------- 17 files changed, 13 insertions(+), 312 deletions(-) delete mode 100644 exasol_data_science_utils_python/udf_utils/abstract_bucketfs_location.py delete mode 100644 exasol_data_science_utils_python/udf_utils/bucketfs_factory.py delete mode 100644 exasol_data_science_utils_python/udf_utils/bucketfs_location.py delete mode 100644 exasol_data_science_utils_python/udf_utils/localfs_mock_bucketfs_location.py delete mode 100644 tests/integration_tests/test_bucketfs_location.py delete mode 100644 tests/unit_tests/udf_utils/test_bucketfs_factory.py delete mode 100644 tests/unit_tests/udf_utils/test_localfs_mock_bucketfs_location.py diff --git a/exasol_data_science_utils_python/model_utils/udfs/combine_to_voting_regressor_udf.py b/exasol_data_science_utils_python/model_utils/udfs/combine_to_voting_regressor_udf.py index c42232f..ec381c3 100644 --- a/exasol_data_science_utils_python/model_utils/udfs/combine_to_voting_regressor_udf.py +++ b/exasol_data_science_utils_python/model_utils/udfs/combine_to_voting_regressor_udf.py @@ -5,8 +5,8 @@ from exasol_data_science_utils_python.model_utils.model_aggregator import combine_to_voting_regressor from exasol_data_science_utils_python.model_utils.partial_fit_iterator import RegressorPartialFitIterator from exasol_data_science_utils_python.model_utils.score_iterator import ScoreIterator -from exasol_data_science_utils_python.udf_utils.abstract_bucketfs_location import AbstractBucketFSLocation -from exasol_data_science_utils_python.udf_utils.bucketfs_factory import BucketFSFactory +from exasol_bucketfs_utils_python.abstract_bucketfs_location import AbstractBucketFSLocation +from exasol_bucketfs_utils_python.bucketfs_factory import BucketFSFactory class CombineToVotingRegressorUDF: diff --git a/exasol_data_science_utils_python/model_utils/udfs/partial_fit_regression_training_runner.py b/exasol_data_science_utils_python/model_utils/udfs/partial_fit_regression_training_runner.py index ff09a69..15b0e1e 100644 --- a/exasol_data_science_utils_python/model_utils/udfs/partial_fit_regression_training_runner.py +++ b/exasol_data_science_utils_python/model_utils/udfs/partial_fit_regression_training_runner.py @@ -15,8 +15,8 @@ from exasol_data_science_utils_python.preprocessing.sql_to_scikit_learn.table_preprocessor import TablePreprocessor from exasol_data_science_utils_python.preprocessing.sql_to_scikit_learn.table_preprocessor_factory import \ TablePreprocessorFactory -from exasol_data_science_utils_python.udf_utils.bucketfs_factory import BucketFSFactory -from exasol_data_science_utils_python.udf_utils.bucketfs_location import BucketFSLocation +from exasol_bucketfs_utils_python.bucketfs_factory import BucketFSFactory +from exasol_bucketfs_utils_python.bucketfs_location import BucketFSLocation from exasol_data_science_utils_python.udf_utils.pyexasol_sql_executor import PyexasolSQLExecutor from exasol_data_science_utils_python.udf_utils.sql_executor import SQLExecutor diff --git a/exasol_data_science_utils_python/model_utils/udfs/partial_fit_regressor_udf.py b/exasol_data_science_utils_python/model_utils/udfs/partial_fit_regressor_udf.py index 20c440f..03caccc 100644 --- a/exasol_data_science_utils_python/model_utils/udfs/partial_fit_regressor_udf.py +++ b/exasol_data_science_utils_python/model_utils/udfs/partial_fit_regressor_udf.py @@ -3,7 +3,7 @@ from tenacity import Retrying, stop_after_delay, wait_fixed -from exasol_data_science_utils_python.udf_utils.bucketfs_factory import BucketFSFactory +from exasol_bucketfs_utils_python.bucketfs_factory import BucketFSFactory from exasol_data_science_utils_python.udf_utils.udf_context_wrapper import UDFContextWrapper MODEL_CONNECTION_NAME_PARAMETER = "0" diff --git a/exasol_data_science_utils_python/model_utils/udfs/predict_regressor_udf.py b/exasol_data_science_utils_python/model_utils/udfs/predict_regressor_udf.py index 399a3ff..b0c9fdd 100644 --- a/exasol_data_science_utils_python/model_utils/udfs/predict_regressor_udf.py +++ b/exasol_data_science_utils_python/model_utils/udfs/predict_regressor_udf.py @@ -2,7 +2,7 @@ from pathlib import PurePosixPath from exasol_data_science_utils_python.model_utils.prediction_iterator import PredictionIterator -from exasol_data_science_utils_python.udf_utils.bucketfs_factory import BucketFSFactory +from exasol_bucketfs_utils_python.bucketfs_factory import BucketFSFactory from exasol_data_science_utils_python.udf_utils.udf_context_wrapper import UDFContextWrapper MODEL_CONNECTION_NAME_PARAMETER = "0" diff --git a/exasol_data_science_utils_python/model_utils/udfs/score_regressor_udf.py b/exasol_data_science_utils_python/model_utils/udfs/score_regressor_udf.py index 2937c92..c5c179d 100644 --- a/exasol_data_science_utils_python/model_utils/udfs/score_regressor_udf.py +++ b/exasol_data_science_utils_python/model_utils/udfs/score_regressor_udf.py @@ -2,7 +2,7 @@ from pathlib import PurePosixPath from exasol_data_science_utils_python.model_utils.score_iterator import ScoreIterator -from exasol_data_science_utils_python.udf_utils.bucketfs_factory import BucketFSFactory +from exasol_bucketfs_utils_python.bucketfs_factory import BucketFSFactory from exasol_data_science_utils_python.udf_utils.udf_context_wrapper import UDFContextWrapper diff --git a/exasol_data_science_utils_python/udf_utils/abstract_bucketfs_location.py b/exasol_data_science_utils_python/udf_utils/abstract_bucketfs_location.py deleted file mode 100644 index 320be82..0000000 --- a/exasol_data_science_utils_python/udf_utils/abstract_bucketfs_location.py +++ /dev/null @@ -1,30 +0,0 @@ -import typing -from abc import ABC, abstractmethod -from typing import Any - - -class AbstractBucketFSLocation(ABC): - - @abstractmethod - def download_from_bucketfs_to_string(self, bucket_file_path: str) -> str: - pass - - @abstractmethod - def download_object_from_bucketfs_via_joblib(self, bucket_file_path: str) -> Any: - pass - - @abstractmethod - def upload_string_to_bucketfs(self, bucket_file_path: str, string: str): - pass - - @abstractmethod - def upload_object_to_bucketfs_via_joblib(self, object: Any, - bucket_file_path: str, - **kwargs): - pass - - @abstractmethod - def upload_fileobj_to_bucketfs(self, - fileobj: typing.IO, - bucket_file_path: str): - pass diff --git a/exasol_data_science_utils_python/udf_utils/bucketfs_factory.py b/exasol_data_science_utils_python/udf_utils/bucketfs_factory.py deleted file mode 100644 index d83d1f7..0000000 --- a/exasol_data_science_utils_python/udf_utils/bucketfs_factory.py +++ /dev/null @@ -1,53 +0,0 @@ -import urllib.parse -from pathlib import PurePosixPath -from typing import Union - -from exasol_bucketfs_utils_python.bucket_config import BucketConfig -from exasol_bucketfs_utils_python.bucketfs_config import BucketFSConfig -from exasol_bucketfs_utils_python.bucketfs_connection_config import BucketFSConnectionConfig - -from exasol_data_science_utils_python.udf_utils.bucketfs_location import BucketFSLocation -from exasol_data_science_utils_python.udf_utils.localfs_mock_bucketfs_location import LocalFSMockBucketFSLocation - - -class BucketFSFactory: - - def create_bucketfs_location(self, url: str, user: str, pwd: str, base_path: Union[PurePosixPath, None] = None): - """ - Create BucketFSLocation from the the url given. If the url has the schema http:// or https://, - this function creates a real BucketFSLocation for a url scheme file:/// we create a LocalFSMockBucketFSLocation. - For url with http:// or https:// schema you also need to provide the bucketfs-name via a url parameter. - A url would look like the following: http[s]://://; - :param url: - :param user: - :param pwd: - :param base_path: - :return: - """ - parsed_url = urllib.parse.urlparse(url) - if parsed_url.scheme == "http" or parsed_url.scheme == "https": - is_https = parsed_url.scheme == "https" - connection_config = BucketFSConnectionConfig(host=parsed_url.hostname, - port=parsed_url.port, - user=user, pwd=pwd, - is_https=is_https) - url_path = PurePosixPath(parsed_url.path) - bucket_name = url_path.parts[1] - base_path_in_bucket = PurePosixPath(url_path.parts[2]).joinpath(*url_path.parts[3:]) - if base_path is not None: - base_path_in_bucket = PurePosixPath(base_path_in_bucket, base_path) - bucketfs_name = parsed_url.params - bucketfs_config = BucketFSConfig(bucketfs_name, connection_config=connection_config) - bucket_config = BucketConfig(bucket_name=bucket_name, bucketfs_config=bucketfs_config) - bucketfs_location = BucketFSLocation(bucket_config, base_path_in_bucket) - return bucketfs_location - elif parsed_url.scheme == "file": - if parsed_url.netloc != '': - raise ValueError(f"URL '{url}' with file:// schema and netloc not support.") - base_path_in_bucket = PurePosixPath(parsed_url.path) - if base_path is not None: - base_path_in_bucket = PurePosixPath(base_path_in_bucket, base_path) - bucketfs_location = LocalFSMockBucketFSLocation(base_path_in_bucket) - return bucketfs_location - else: - raise ValueError(f"Invalid url schema for url {url}") diff --git a/exasol_data_science_utils_python/udf_utils/bucketfs_location.py b/exasol_data_science_utils_python/udf_utils/bucketfs_location.py deleted file mode 100644 index 1d72f04..0000000 --- a/exasol_data_science_utils_python/udf_utils/bucketfs_location.py +++ /dev/null @@ -1,56 +0,0 @@ -import typing -from pathlib import PurePosixPath -from typing import Any - -from exasol_bucketfs_utils_python import download, upload -from exasol_bucketfs_utils_python.bucket_config import BucketConfig - -from exasol_data_science_utils_python.udf_utils.abstract_bucketfs_location import AbstractBucketFSLocation - - -class BucketFSLocation(AbstractBucketFSLocation): - - def __init__(self, bucket_config: BucketConfig, base_path: PurePosixPath): - self.base_path = base_path - self.bucket_config = bucket_config - - def get_complete_file_path_in_bucket(self, bucket_file_path) -> str: - return str(PurePosixPath(self.base_path, bucket_file_path)) - - def download_from_bucketfs_to_string(self, bucket_file_path: str) -> str: - result = download.download_from_bucketfs_to_string( - self.bucket_config, - self.get_complete_file_path_in_bucket(bucket_file_path)) - return result - - def download_object_from_bucketfs_via_joblib(self, bucket_file_path: str) -> Any: - result = download.download_object_from_bucketfs_via_joblib( - self.bucket_config, - self.get_complete_file_path_in_bucket(bucket_file_path)) - return result - - def upload_string_to_bucketfs(self, bucket_file_path: str, string: str): - result = upload.upload_string_to_bucketfs( - self.bucket_config, - self.get_complete_file_path_in_bucket(bucket_file_path), - string) - return result - - def upload_object_to_bucketfs_via_joblib(self, object: Any, - bucket_file_path: str, - **kwargs): - result = upload.upload_object_to_bucketfs_via_joblib( - object, - self.bucket_config, - self.get_complete_file_path_in_bucket(bucket_file_path), - **kwargs) - return result - - def upload_fileobj_to_bucketfs(self, - fileobj: typing.IO, - bucket_file_path: str): - result = upload.upload_fileobj_to_bucketfs( - self.bucket_config, - self.get_complete_file_path_in_bucket(bucket_file_path), - fileobj) - return result diff --git a/exasol_data_science_utils_python/udf_utils/localfs_mock_bucketfs_location.py b/exasol_data_science_utils_python/udf_utils/localfs_mock_bucketfs_location.py deleted file mode 100644 index 52297a3..0000000 --- a/exasol_data_science_utils_python/udf_utils/localfs_mock_bucketfs_location.py +++ /dev/null @@ -1,47 +0,0 @@ -import typing -from pathlib import PurePosixPath, Path -from typing import Any - -import joblib - -from exasol_data_science_utils_python.udf_utils.abstract_bucketfs_location import AbstractBucketFSLocation - - -class LocalFSMockBucketFSLocation(AbstractBucketFSLocation): - - def __init__(self, base_path: PurePosixPath): - self.base_path = base_path - - def get_complete_file_path_in_bucket(self, bucket_file_path) -> str: - return str(PurePosixPath(self.base_path, bucket_file_path)) - - def download_from_bucketfs_to_string(self, bucket_file_path: str) -> str: - with open(self.get_complete_file_path_in_bucket(bucket_file_path), "rt") as f: - result = f.read() - return result - - def download_object_from_bucketfs_via_joblib(self, bucket_file_path: str) -> Any: - result = joblib.load(self.get_complete_file_path_in_bucket(bucket_file_path)) - return result - - def upload_string_to_bucketfs(self, bucket_file_path: str, string: str): - path = self.get_complete_file_path_in_bucket(bucket_file_path) - Path(path).parent.mkdir(parents=True, exist_ok=True) - with open(path, "wt") as f: - f.write(string) - - def upload_object_to_bucketfs_via_joblib(self, object: Any, - bucket_file_path: str, - **kwargs): - path = self.get_complete_file_path_in_bucket(bucket_file_path) - Path(path).parent.mkdir(parents=True, exist_ok=True) - joblib.dump(object, path, **kwargs) - - def upload_fileobj_to_bucketfs(self, - fileobj: typing.IO, - bucket_file_path: str): - path = self.get_complete_file_path_in_bucket(bucket_file_path) - Path(path).parent.mkdir(parents=True, exist_ok=True) - with open(path, "wb") as f: - for chunk in iter(lambda: fileobj.read(10000), ''): - f.write(chunk) diff --git a/tests/integration_tests/test_bucketfs_location.py b/tests/integration_tests/test_bucketfs_location.py deleted file mode 100644 index fc9ea1f..0000000 --- a/tests/integration_tests/test_bucketfs_location.py +++ /dev/null @@ -1,43 +0,0 @@ -from pathlib import PurePosixPath - -from exasol_bucketfs_utils_python.bucket_config import BucketConfig -from exasol_bucketfs_utils_python.bucketfs_config import BucketFSConfig -from exasol_bucketfs_utils_python.bucketfs_connection_config import BucketFSConnectionConfig - -from exasol_data_science_utils_python.udf_utils.bucketfs_location import BucketFSLocation - - -def test_upload_download_string_with_different_instance(): - connection_config = BucketFSConnectionConfig(host="localhost", port=6583, user="w", pwd="write", is_https=False) - bucketfs_config = BucketFSConfig("bfsdefault", connection_config=connection_config) - bucket_config = BucketConfig(bucket_name="default", bucketfs_config=bucketfs_config) - bucket_base_path = PurePosixPath("test") - bucketfs_location_upload = BucketFSLocation(bucket_config, bucket_base_path) - bucketfs_location_download = BucketFSLocation(bucket_config, bucket_base_path) - bucket_file_path = "test_file.txt" - test_string = "test_string" - bucketfs_location_upload.upload_string_to_bucketfs(bucket_file_path, test_string) - result = bucketfs_location_download.download_from_bucketfs_to_string(bucket_file_path) - assert result == test_string - - -class TestValue(): - def __init__(self, value: str): - self.value = value - - def __eq__(self, other): - return self.value == self.value - - -def test_upload_download_obj_with_different_instance(): - connection_config = BucketFSConnectionConfig(host="localhost", port=6583, user="w", pwd="write", is_https=False) - bucketfs_config = BucketFSConfig("bfsdefault", connection_config=connection_config) - bucket_config = BucketConfig(bucket_name="default", bucketfs_config=bucketfs_config) - bucket_base_path = PurePosixPath("test") - bucketfs_location_upload = BucketFSLocation(bucket_config, bucket_base_path) - bucketfs_location_download = BucketFSLocation(bucket_config, bucket_base_path) - bucket_file_path = "test_file.txt" - test_value = TestValue("test_string") - bucketfs_location_upload.upload_object_to_bucketfs_via_joblib(test_value, bucket_file_path) - result = bucketfs_location_download.download_object_from_bucketfs_via_joblib(bucket_file_path) - assert result == test_value diff --git a/tests/integration_tests/test_train_udf.py b/tests/integration_tests/test_train_udf.py index 7427ab2..3db123e 100644 --- a/tests/integration_tests/test_train_udf.py +++ b/tests/integration_tests/test_train_udf.py @@ -11,7 +11,7 @@ from exasol_udf_mock_python.udf_mock_executor import UDFMockExecutor from exasol_data_science_utils_python.preprocessing.sql.schema.schema_name import SchemaName -from exasol_data_science_utils_python.udf_utils.bucketfs_factory import BucketFSFactory +from exasol_bucketfs_utils_python.bucketfs_factory import BucketFSFactory @pytest.fixture(scope="session") diff --git a/tests/unit_tests/model_utils/udfs/test_combine_to_voting_regressor_udf.py b/tests/unit_tests/model_utils/udfs/test_combine_to_voting_regressor_udf.py index d7103e9..0922846 100644 --- a/tests/unit_tests/model_utils/udfs/test_combine_to_voting_regressor_udf.py +++ b/tests/unit_tests/model_utils/udfs/test_combine_to_voting_regressor_udf.py @@ -26,8 +26,8 @@ from exasol_data_science_utils_python.preprocessing.sql_to_scikit_learn.column_set_preprocessor import \ ColumnSetPreprocessor from exasol_data_science_utils_python.preprocessing.sql_to_scikit_learn.table_preprocessor import TablePreprocessor -from exasol_data_science_utils_python.udf_utils.abstract_bucketfs_location import AbstractBucketFSLocation -from exasol_data_science_utils_python.udf_utils.bucketfs_factory import BucketFSFactory +from exasol_bucketfs_utils_python.abstract_bucketfs_location import AbstractBucketFSLocation +from exasol_bucketfs_utils_python.bucketfs_factory import BucketFSFactory def udf_wrapper(): diff --git a/tests/unit_tests/model_utils/udfs/test_partial_fit_regressor_udf.py b/tests/unit_tests/model_utils/udfs/test_partial_fit_regressor_udf.py index d4f7d99..f4cb74e 100644 --- a/tests/unit_tests/model_utils/udfs/test_partial_fit_regressor_udf.py +++ b/tests/unit_tests/model_utils/udfs/test_partial_fit_regressor_udf.py @@ -19,7 +19,7 @@ from exasol_data_science_utils_python.preprocessing.sql_to_scikit_learn.column_set_preprocessor import \ ColumnSetPreprocessor from exasol_data_science_utils_python.preprocessing.sql_to_scikit_learn.table_preprocessor import TablePreprocessor -from exasol_data_science_utils_python.udf_utils.bucketfs_factory import BucketFSFactory +from exasol_bucketfs_utils_python.bucketfs_factory import BucketFSFactory def udf_wrapper(): diff --git a/tests/unit_tests/model_utils/udfs/test_predict_regressor_udf.py b/tests/unit_tests/model_utils/udfs/test_predict_regressor_udf.py index 61777b3..e4af794 100644 --- a/tests/unit_tests/model_utils/udfs/test_predict_regressor_udf.py +++ b/tests/unit_tests/model_utils/udfs/test_predict_regressor_udf.py @@ -18,7 +18,7 @@ from exasol_data_science_utils_python.preprocessing.sql_to_scikit_learn.column_set_preprocessor import \ ColumnSetPreprocessor from exasol_data_science_utils_python.preprocessing.sql_to_scikit_learn.table_preprocessor import TablePreprocessor -from exasol_data_science_utils_python.udf_utils.bucketfs_factory import BucketFSFactory +from exasol_bucketfs_utils_python.bucketfs_factory import BucketFSFactory def udf_wrapper(): diff --git a/tests/unit_tests/model_utils/udfs/test_score_regressor_udf.py b/tests/unit_tests/model_utils/udfs/test_score_regressor_udf.py index c25f4f0..275cd52 100644 --- a/tests/unit_tests/model_utils/udfs/test_score_regressor_udf.py +++ b/tests/unit_tests/model_utils/udfs/test_score_regressor_udf.py @@ -10,7 +10,6 @@ from numpy.random import RandomState from sklearn.linear_model import SGDRegressor -from exasol_data_science_utils_python.model_utils.partial_fit_iterator import RegressorPartialFitIterator from exasol_data_science_utils_python.model_utils.score_iterator import ScoreIterator from exasol_data_science_utils_python.preprocessing.scikit_learn.sklearn_prefitted_column_transformer import \ SKLearnPrefittedColumnTransformer @@ -19,7 +18,7 @@ from exasol_data_science_utils_python.preprocessing.sql_to_scikit_learn.column_set_preprocessor import \ ColumnSetPreprocessor from exasol_data_science_utils_python.preprocessing.sql_to_scikit_learn.table_preprocessor import TablePreprocessor -from exasol_data_science_utils_python.udf_utils.bucketfs_factory import BucketFSFactory +from exasol_bucketfs_utils_python.bucketfs_factory import BucketFSFactory def udf_wrapper(): diff --git a/tests/unit_tests/udf_utils/test_bucketfs_factory.py b/tests/unit_tests/udf_utils/test_bucketfs_factory.py deleted file mode 100644 index a6ae711..0000000 --- a/tests/unit_tests/udf_utils/test_bucketfs_factory.py +++ /dev/null @@ -1,36 +0,0 @@ -from pathlib import PurePosixPath -from tempfile import TemporaryDirectory - -from exasol_data_science_utils_python.udf_utils.bucketfs_factory import BucketFSFactory - - -def test_create_localfs_mock_bucketfs_location(): - with TemporaryDirectory() as path: - url = f"file://{path}/bucket" - bucketfs_location = BucketFSFactory().create_bucketfs_location(url, user=None, pwd=None, base_path=PurePosixPath("base")) - complete_path = bucketfs_location.get_complete_file_path_in_bucket("bucket_file_path") - print(complete_path) - assert complete_path == f"{path}/bucket/base/bucket_file_path" - - -def test_create_real_bucketfs_location(): - host = "localhost" - port = 6583 - path_in_bucket = "path_in_bucket" - bucketfs_name = "bucketfsname" - user = "w" - pwd = "write" - base_path = "base" - bucket_file_path = "bucket_file_path" - bucket = "bucket" - url = f"http://{host}:{port}/{bucket}/{path_in_bucket};{bucketfs_name}" - bucketfs_location = BucketFSFactory().create_bucketfs_location(url, user=user, pwd=pwd, base_path=PurePosixPath(base_path)) - complete_path = bucketfs_location.get_complete_file_path_in_bucket(bucket_file_path) - assert complete_path == f"{path_in_bucket}/{base_path}/{bucket_file_path}" and \ - bucketfs_location.bucket_config.bucket_name == bucket and \ - bucketfs_location.bucket_config.bucketfs_config.bucketfs_name == bucketfs_name and \ - bucketfs_location.bucket_config.bucketfs_config.connection_config.host == host and \ - bucketfs_location.bucket_config.bucketfs_config.connection_config.port == port and \ - bucketfs_location.bucket_config.bucketfs_config.connection_config.is_https == False and \ - bucketfs_location.bucket_config.bucketfs_config.connection_config.user == user and \ - bucketfs_location.bucket_config.bucketfs_config.connection_config.pwd == pwd diff --git a/tests/unit_tests/udf_utils/test_localfs_mock_bucketfs_location.py b/tests/unit_tests/udf_utils/test_localfs_mock_bucketfs_location.py deleted file mode 100644 index 69408ec..0000000 --- a/tests/unit_tests/udf_utils/test_localfs_mock_bucketfs_location.py +++ /dev/null @@ -1,33 +0,0 @@ -from tempfile import TemporaryDirectory - -from exasol_data_science_utils_python.udf_utils.localfs_mock_bucketfs_location import LocalFSMockBucketFSLocation - - -def test_upload_download_string_with_different_instance(): - with TemporaryDirectory() as path: - bucketfs_location_upload = LocalFSMockBucketFSLocation(path) - bucketfs_location_download = LocalFSMockBucketFSLocation(path) - bucket_file_path = "test_file.txt" - test_string = "test_string" - bucketfs_location_upload.upload_string_to_bucketfs(bucket_file_path, test_string) - result = bucketfs_location_download.download_from_bucketfs_to_string(bucket_file_path) - assert result == test_string - - -class TestValue(): - def __init__(self, value: str): - self.value = value - - def __eq__(self, other): - return self.value == self.value - - -def test_upload_download_obj_with_different_instance(): - with TemporaryDirectory() as path: - bucketfs_location_upload = LocalFSMockBucketFSLocation(path) - bucketfs_location_download = LocalFSMockBucketFSLocation(path) - bucket_file_path = "test_file.txt" - test_value = TestValue("test_string") - bucketfs_location_upload.upload_object_to_bucketfs_via_joblib(test_value, bucket_file_path) - result = bucketfs_location_download.download_object_from_bucketfs_via_joblib(bucket_file_path) - assert result == test_value From 3d884710d3d95c3c94011a98e8fe9c173a5be55a Mon Sep 17 00:00:00 2001 From: MarleneKress79789 Date: Fri, 12 Nov 2021 14:31:20 +0100 Subject: [PATCH 2/2] #46: Added Changes to changes_0.1.0.md. --- doc/changes/changes_0.1.0.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/changes/changes_0.1.0.md b/doc/changes/changes_0.1.0.md index e69de29..ed2b51f 100644 --- a/doc/changes/changes_0.1.0.md +++ b/doc/changes/changes_0.1.0.md @@ -0,0 +1,3 @@ +### Refactorings + + - #46: Moved BucketFS Location from exasol_data_science_utils_python to bucketfs_utils_python. \ No newline at end of file