Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deploy_utils.py w async execution support #27

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alex-stoica
Copy link
Contributor

This PR enhances the deploy_utils.py file to support asynchronous execution of the pipeline_run method using run_in_threadpool. This change allows the server to handle multiple pipeline requests concurrently, improving performance and efficiency.

I've already tested it locally with a docker-compose.yml with

services:
  hayhooks:
    image: deepset/hayhooks:main
    ports:
      - "1416:1416"
    volumes:
      - ./pipelines:/opt/pipelines
      - ./custom_components:/opt/custom_components
      - ./my_custom_deploy_utils.py:/opt/venv/lib/python3.12/site-packages/hayhooks/server/utils/deploy_utils.py
    environment:
      - PYTHONPATH=/opt
      - HAYHOOKS_ADDITIONAL_PYTHONPATH=/opt/custom_components

where my_custom_deploy_utils.py is the adjusted file (with run_in_threadpool etc)

If you need additional testing resources, I've created a dummy component that just waits, some pipeline and send_requests_and_save.py that makes multiple async request in order
previously

df = pd.read_csv("output.csv")
df.started_at = pd.to_datetime(df.started_at)
df.sort_values(by = 'started_at')

Returned syncronous result of the format
image
(pipeline 4 starts after all tasks from pipeline 1 are ended)

With the changes, it returned me
image
which look intertwined (async)

test_pipelines.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant