mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-07-24 01:10:45 +00:00

* Fist attempt at using setup.cfg for dependency management * Trying the new package on the CI and in Docker too * Add composite extras_require * Add the safe_import function for document store imports and add some try-catch statements on rest_api and ui imports * Fix bug on class import and rephrase error message * Introduce typing for optional modules and add type: ignore in sparse.py * Include importlib_metadata backport for py3.7 * Add colab group to extra_requires * Fix pillow version * Fix grpcio * Separate out the crawler as another extra * Make paths relative in rest_api and ui * Update the test matrix in the CI * Add try catch statements around the optional imports too to account for direct imports * Never mix direct deps with self-references and add ES deps to the base install * Refactor several paths in tests to make them insensitive to the execution path * Include tstadel review and re-introduce Milvus1 in the tests suite, to fix * Wrap pdf conversion utils into safe_import * Update some tutorials and rever Milvus1 as default for now, see #2067 * Fix mypy config Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
32 lines
952 B
Python
32 lines
952 B
Python
from pathlib import Path
|
|
|
|
import pytest
|
|
import ray
|
|
|
|
from haystack.pipelines import RayPipeline
|
|
|
|
from conftest import SAMPLES_PATH
|
|
|
|
|
|
@pytest.mark.parametrize("document_store_with_docs", ["elasticsearch"], indirect=True)
|
|
def test_load_pipeline(document_store_with_docs):
|
|
pipeline = RayPipeline.load_from_yaml(
|
|
SAMPLES_PATH/"pipeline"/"test_pipeline.yaml", pipeline_name="ray_query_pipeline", num_cpus=8,
|
|
)
|
|
prediction = pipeline.run(query="Who lives in Berlin?", params={"Retriever": {"top_k": 10}, "Reader": {"top_k": 3}})
|
|
|
|
assert ray.serve.get_deployment(name="ESRetriever").num_replicas == 2
|
|
assert ray.serve.get_deployment(name="Reader").num_replicas == 1
|
|
assert prediction["query"] == "Who lives in Berlin?"
|
|
assert prediction["answers"][0].answer == "Carla"
|
|
|
|
|
|
@pytest.fixture(scope="function", autouse=True)
|
|
def shutdown_ray():
|
|
yield
|
|
try:
|
|
import ray
|
|
ray.shutdown()
|
|
except:
|
|
pass
|