Skip to content

Commit 2e1879a

Browse files
committed
fixing the integration tests
Signed-off-by: Abdul Hameed <ahameed@redhat.com>
1 parent e34b070 commit 2e1879a

File tree

6 files changed

+36
-27
lines changed

6 files changed

+36
-27
lines changed

sdk/python/requirements/py3.10-ci-requirements.txt

-2
Original file line numberDiff line numberDiff line change
@@ -486,8 +486,6 @@ multidict==6.0.5
486486
# yarl
487487
multipledispatch==1.0.0
488488
# via ibis-framework
489-
multiprocess==0.70.16
490-
# via feast (setup.py)
491489
mypy==1.10.0
492490
# via
493491
# feast (setup.py)

sdk/python/requirements/py3.11-ci-requirements.txt

-2
Original file line numberDiff line numberDiff line change
@@ -477,8 +477,6 @@ multidict==6.0.5
477477
# yarl
478478
multipledispatch==1.0.0
479479
# via ibis-framework
480-
multiprocess==0.70.16
481-
# via feast (setup.py)
482480
mypy==1.10.0
483481
# via
484482
# feast (setup.py)

sdk/python/requirements/py3.9-ci-requirements.txt

-2
Original file line numberDiff line numberDiff line change
@@ -495,8 +495,6 @@ multidict==6.0.5
495495
# yarl
496496
multipledispatch==1.0.0
497497
# via ibis-framework
498-
multiprocess==0.70.16
499-
# via feast (setup.py)
500498
mypy==1.10.0
501499
# via
502500
# feast (setup.py)

sdk/python/tests/integration/feature_repos/universal/data_sources/file.py

+33-17
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
1+
import logging
12
import os.path
23
import shutil
4+
import subprocess
35
import tempfile
46
import uuid
7+
from pathlib import Path
58
from typing import Any, Dict, List, Optional
69

710
import pandas as pd
811
import pyarrow as pa
912
import pyarrow.parquet as pq
13+
import yaml
1014
from minio import Minio
11-
from multiprocess import Process
1215
from testcontainers.core.generic import DockerContainer
1316
from testcontainers.core.waiting_utils import wait_for_logs
1417
from testcontainers.minio import MinioContainer
1518

16-
from feast import FeatureStore, FileSource, RepoConfig
19+
from feast import FileSource, RepoConfig
1720
from feast.data_format import DeltaFormat, ParquetFormat
1821
from feast.data_source import DataSource
1922
from feast.feature_logging import LoggingDestination
@@ -24,14 +27,15 @@
2427
SavedDatasetFileStorage,
2528
)
2629
from feast.infra.offline_stores.remote import RemoteOfflineStoreConfig
27-
from feast.offline_server import start_server
2830
from feast.repo_config import FeastConfigBaseModel, RegistryConfig
2931
from feast.wait import wait_retry_backoff # noqa: E402
3032
from tests.integration.feature_repos.universal.data_source_creator import (
3133
DataSourceCreator,
3234
)
3335
from tests.utils.http_server import check_port_open, free_port # noqa: E402
3436

37+
logger = logging.getLogger(__name__)
38+
3539

3640
class FileDataSourceCreator(DataSourceCreator):
3741
files: List[Any]
@@ -363,31 +367,43 @@ class RemoteOfflineStoreDataSourceCreator(FileDataSourceCreator):
363367
def __init__(self, project_name: str, *args, **kwargs):
364368
super().__init__(project_name)
365369
self.server_port: int = 0
366-
self.proc: Process = None
370+
self.proc = None
367371

368372
def setup(self, registry: RegistryConfig):
369373
parent_offline_config = super().create_offline_store_config()
370-
371-
fs = FeatureStore(
372-
config=RepoConfig(
373-
project=self.project_name,
374-
provider="local",
375-
offline_store=parent_offline_config,
376-
registry=registry.path,
377-
entity_key_serialization_version=2,
378-
)
374+
config = RepoConfig(
375+
project=self.project_name,
376+
provider="local",
377+
offline_store=parent_offline_config,
378+
registry=registry.path,
379+
entity_key_serialization_version=2,
379380
)
381+
382+
repo_path = Path(tempfile.mkdtemp())
383+
with open(repo_path / "feature_store.yaml", "w") as outfile:
384+
yaml.dump(config.dict(by_alias=True), outfile)
385+
repo_path = str(repo_path.resolve())
386+
380387
self.server_port = free_port()
381388
host = "0.0.0.0"
382-
self.proc = Process(
383-
target=start_server,
384-
args=(fs, host, self.server_port),
389+
cmd = [
390+
"feast",
391+
"-c" + repo_path,
392+
"serve_offline",
393+
"--host",
394+
host,
395+
"--port",
396+
str(self.server_port),
397+
]
398+
self.proc = subprocess.Popen(
399+
cmd, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL
385400
)
386-
self.proc.start()
401+
387402
# Wait for server to start
388403
wait_retry_backoff(
389404
lambda: (None, check_port_open(host, self.server_port)),
390405
timeout_secs=10,
406+
timeout_msg=f"Unable to start the server in 45 seconds on {host}:{self.server_port}.",
391407
)
392408
return "grpc+tcp://{}:{}".format(host, self.server_port)
393409

sdk/python/tests/utils/http_server.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44

55
def free_port():
6-
sock = socket.socket()
7-
sock.bind(("", 0))
8-
return sock.getsockname()[1]
6+
with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock:
7+
sock.bind(("", 0))
8+
return sock.getsockname()[1]
99

1010

1111
def check_port_open(host, port) -> bool:

setup.py

-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@
168168
"mock==2.0.0",
169169
"moto<5",
170170
"mypy>=1.4.1",
171-
"multiprocess>=0.70.16",
172171
"urllib3>=1.25.4,<3",
173172
"psutil==5.9.0",
174173
"py>=1.11.0", # https://github.com/pytest-dev/pytest/issues/10420

0 commit comments

Comments
 (0)