mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-07-23 17:00:41 +00:00

* Extending the Ray Serve integration to allow attributes for Serve deployments This closes #2917 We should be able to set Ray Serve attributes for the nodes of pipelines, like amount of GPU to use, max_concurrent_queries, etc. Now this is possible from the pipeline yaml file for each node of the pipeline. * Ran black and regenerated the json schemas * Fixing the JSON Schema generation * Trying to fix the schema CI test issue * Fixing the test and the schemas Python 3.8 was generating a different schema than Python 3.7 is creating in the CI. You MUST use Python 3.7 to generate the schemas, otherwise the CIs will fail. * Merge the two Ray pipeline test cases * Generate the JSON schemas again after `$ pip install .[all]` * Removing `haystack/json-schemas/haystack-pipeline-1.16.schema.json` This was generated by the JSON generator, but based on @ZanSara's instructions, I am removing it. * Making changes based on @ZanSara's request - the newly requested test is failing * Fixing the JSON schema generation again * Renaming `replicas` and moving it under `serve_deployment_kwargs` * add extras validation, untested * Dcoumentation update * Black * [EMPTY] Re-trigger CI Co-authored-by: Sara Zan <sarazanzo94@gmail.com>
38 lines
1.2 KiB
Python
38 lines
1.2 KiB
Python
from pathlib import Path
|
|
|
|
import pytest
|
|
import ray
|
|
|
|
from haystack.pipelines import RayPipeline
|
|
|
|
from ..conftest import SAMPLES_PATH
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def shutdown_ray():
|
|
yield
|
|
try:
|
|
import ray
|
|
|
|
ray.shutdown()
|
|
except:
|
|
pass
|
|
|
|
|
|
@pytest.mark.integration
|
|
@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" / "ray.haystack-pipeline.yml",
|
|
pipeline_name="ray_query_pipeline",
|
|
ray_args={"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 ray.serve.get_deployment(name="ESRetriever").max_concurrent_queries == 17
|
|
assert ray.serve.get_deployment(name="ESRetriever").ray_actor_options["num_cpus"] == 0.5
|
|
assert prediction["query"] == "Who lives in Berlin?"
|
|
assert prediction["answers"][0].answer == "Carla"
|