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

[Feature][Executor] Refine the image startup scripts to support customized executor image #2762

Closed
wants to merge 11 commits into from

Conversation

PeiwenGaoMS
Copy link
Contributor

@PeiwenGaoMS PeiwenGaoMS commented Apr 11, 2024

Description

Background

To facilitate customers in choosing their desired Python version within the executor image (default version: 3.9), we will offer a simple and efficient solution that allows users to quickly build custom images.

Implementation

  • Integrate an entry point into promptflow-core.
  • Include uvicorn and gunicorn as extra dependencies in promptflow-core.
  • Implement run mode (serving/compute) detection within the entry point to start the app accordingly.

Usage

Once the changes from this PR are released to the public version of promptflow, customers can easily build their desired Python version of the executor image using the Dockerfile below, and then add it to the flow yaml to create an automatic runtime for use.

# Choose different python base image
FROM python:3.11

# Install promptflow related package
RUN pip install promptflow_tracing
RUN pip install promptflow_core[executor-service,azureml-serving]
RUN pip install promptflow_devkit
RUN pip install promptflow

# Set port
USER root:root
ENV PORT 8000
EXPOSE $PORT

CMD ["pfapp"]
# Add this part to flow yaml
environment:
  image: <image-name>

Test Links

image

PR Changes Summary

This pull request primarily updates the src/promptflow-core package to include a new execution_app.py module and modifies the pyproject.toml file to include new dependencies and scripts. The execution_app.py module includes a new RunMode class, functions to get the number of processes based on the CPU core number, check if a given model directory contains certain files, get the run mode, and start the server based on the run mode. The pyproject.toml file has been updated to include uvicorn and gunicorn as dependencies and a new script to start the server.

Here are the most important changes:

  • src/promptflow-core/promptflow/execution_app.py: A new module that includes a RunMode class, functions to get the process number based on the CPU core number, check if a given model directory contains certain files, get the run mode, and start the server based on the run mode.

Updates to pyproject.toml:

All Promptflow Contribution checklist:

  • The pull request does not introduce [breaking changes].
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request to get dedicated review from promptflow team. Learn more: suggested workflow.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

Copy link

github-actions bot commented Apr 11, 2024

promptflow-core test result

0 tests   0 ✅  0s ⏱️
0 suites  0 💤
0 files    0 ❌

Results for commit 44c361c.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Apr 11, 2024

SDK CLI Global Config Test Result devs/peiwen/add_image_entrypoint

3 tests   3 ✅  1m 25s ⏱️
1 suites  0 💤
1 files    0 ❌

Results for commit 44c361c.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Apr 11, 2024

promptflow SDK CLI Azure E2E Test Result devs/peiwen/add_image_entrypoint

  4 files    4 suites   4m 46s ⏱️
213 tests 193 ✅ 20 💤 0 ❌
852 runs  772 ✅ 80 💤 0 ❌

Results for commit 44c361c.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Apr 11, 2024

Executor Unit Test Result devs/peiwen/add_image_entrypoint

778 tests   778 ✅  3m 41s ⏱️
  1 suites    0 💤
  1 files      0 ❌

Results for commit 44c361c.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Apr 11, 2024

Executor E2E Test Result devs/peiwen/add_image_entrypoint

238 tests   236 ✅  11m 16s ⏱️
  1 suites    2 💤
  1 files      0 ❌

Results for commit 44c361c.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Apr 11, 2024

SDK CLI Test Result devs/peiwen/add_image_entrypoint

    4 files      4 suites   45m 18s ⏱️
  578 tests   557 ✅ 21 💤 0 ❌
2 312 runs  2 228 ✅ 84 💤 0 ❌

Results for commit 44c361c.

♻️ This comment has been updated with latest results.

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

Successfully merging this pull request may close these issues.

1 participant