diff --git a/sdk/python/requirements/py3.10-ci-requirements.txt b/sdk/python/requirements/py3.10-ci-requirements.txt index fa5ddc1c955..d0da39aef42 100644 --- a/sdk/python/requirements/py3.10-ci-requirements.txt +++ b/sdk/python/requirements/py3.10-ci-requirements.txt @@ -486,8 +486,6 @@ multidict==6.0.5 # yarl multipledispatch==1.0.0 # via ibis-framework -multiprocess==0.70.16 - # via feast (setup.py) mypy==1.10.0 # via # feast (setup.py) diff --git a/sdk/python/requirements/py3.11-ci-requirements.txt b/sdk/python/requirements/py3.11-ci-requirements.txt index a780a7dd53d..643e3715c60 100644 --- a/sdk/python/requirements/py3.11-ci-requirements.txt +++ b/sdk/python/requirements/py3.11-ci-requirements.txt @@ -477,8 +477,6 @@ multidict==6.0.5 # yarl multipledispatch==1.0.0 # via ibis-framework -multiprocess==0.70.16 - # via feast (setup.py) mypy==1.10.0 # via # feast (setup.py) diff --git a/sdk/python/requirements/py3.9-ci-requirements.txt b/sdk/python/requirements/py3.9-ci-requirements.txt index c73a92549a3..8aca7006961 100644 --- a/sdk/python/requirements/py3.9-ci-requirements.txt +++ b/sdk/python/requirements/py3.9-ci-requirements.txt @@ -495,8 +495,6 @@ multidict==6.0.5 # yarl multipledispatch==1.0.0 # via ibis-framework -multiprocess==0.70.16 - # via feast (setup.py) mypy==1.10.0 # via # feast (setup.py) diff --git a/sdk/python/tests/integration/feature_repos/universal/data_sources/file.py b/sdk/python/tests/integration/feature_repos/universal/data_sources/file.py index e923801f980..273e14db152 100644 --- a/sdk/python/tests/integration/feature_repos/universal/data_sources/file.py +++ b/sdk/python/tests/integration/feature_repos/universal/data_sources/file.py @@ -1,19 +1,22 @@ +import logging import os.path import shutil +import subprocess import tempfile import uuid +from pathlib import Path from typing import Any, Dict, List, Optional import pandas as pd import pyarrow as pa import pyarrow.parquet as pq +import yaml from minio import Minio -from multiprocess import Process from testcontainers.core.generic import DockerContainer from testcontainers.core.waiting_utils import wait_for_logs from testcontainers.minio import MinioContainer -from feast import FeatureStore, FileSource, RepoConfig +from feast import FileSource, RepoConfig from feast.data_format import DeltaFormat, ParquetFormat from feast.data_source import DataSource from feast.feature_logging import LoggingDestination @@ -24,7 +27,6 @@ SavedDatasetFileStorage, ) from feast.infra.offline_stores.remote import RemoteOfflineStoreConfig -from feast.offline_server import start_server from feast.repo_config import FeastConfigBaseModel, RegistryConfig from feast.wait import wait_retry_backoff # noqa: E402 from tests.integration.feature_repos.universal.data_source_creator import ( @@ -32,6 +34,8 @@ ) from tests.utils.http_server import check_port_open, free_port # noqa: E402 +logger = logging.getLogger(__name__) + class FileDataSourceCreator(DataSourceCreator): files: List[Any] @@ -363,31 +367,44 @@ class RemoteOfflineStoreDataSourceCreator(FileDataSourceCreator): def __init__(self, project_name: str, *args, **kwargs): super().__init__(project_name) self.server_port: int = 0 - self.proc: Process = None + self.proc = None def setup(self, registry: RegistryConfig): parent_offline_config = super().create_offline_store_config() - - fs = FeatureStore( - config=RepoConfig( - project=self.project_name, - provider="local", - offline_store=parent_offline_config, - registry=registry.path, - entity_key_serialization_version=2, - ) + config = RepoConfig( + project=self.project_name, + provider="local", + offline_store=parent_offline_config, + registry=registry.path, + entity_key_serialization_version=2, ) + + repo_path = Path(tempfile.mkdtemp()) + with open(repo_path / "feature_store.yaml", "w") as outfile: + yaml.dump(config.dict(by_alias=True), outfile) + repo_path = str(repo_path.resolve()) + self.server_port = free_port() host = "0.0.0.0" - self.proc = Process( - target=start_server, - args=(fs, host, self.server_port), + cmd = [ + "feast", + "-c" + repo_path, + "serve_offline", + "--host", + host, + "--port", + str(self.server_port), + ] + self.proc = subprocess.Popen( + cmd, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL ) - self.proc.start() + + _time_out_sec: int = 60 # Wait for server to start wait_retry_backoff( lambda: (None, check_port_open(host, self.server_port)), - timeout_secs=10, + timeout_secs=_time_out_sec, + timeout_msg=f"Unable to start the feast server in {_time_out_sec} seconds for remote online store type, port={self.server_port}", ) return "grpc+tcp://{}:{}".format(host, self.server_port) diff --git a/sdk/python/tests/utils/http_server.py b/sdk/python/tests/utils/http_server.py index 47c6cb8ac17..5bb6255d72e 100644 --- a/sdk/python/tests/utils/http_server.py +++ b/sdk/python/tests/utils/http_server.py @@ -3,9 +3,9 @@ def free_port(): - sock = socket.socket() - sock.bind(("", 0)) - return sock.getsockname()[1] + with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock: + sock.bind(("", 0)) + return sock.getsockname()[1] def check_port_open(host, port) -> bool: diff --git a/setup.py b/setup.py index e51c1dea9fd..9b3d0e55e62 100644 --- a/setup.py +++ b/setup.py @@ -168,7 +168,6 @@ "mock==2.0.0", "moto<5", "mypy>=1.4.1", - "multiprocess>=0.70.16", "urllib3>=1.25.4,<3", "psutil==5.9.0", "py>=1.11.0", # https://github.com/pytest-dev/pytest/issues/10420