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

fix: avoid failure when no special pip deps and better exit #1228

Merged
merged 1 commit into from
Feb 24, 2025

Conversation

leseb
Copy link
Contributor

@leseb leseb commented Feb 24, 2025

What does this PR do?

When building providers in a virtual environment or containers, special
pip dependencies may not always be provided (e.g., for Ollama). The
check should only fail if the required number of arguments is missing.
Currently, two arguments are mandatory:

  1. Environment name
  2. Pip dependencies

Additionally, return statements were replaced with sys.exit(1) in error
conditions to ensure immediate termination on critical failures. Error
handling in the stack build process was also improved to guarantee the
program exits with status 1 when facing configuration issues or build
failures.

Signed-off-by: Sébastien Han [email protected]

Test Plan

This command shouldn't fail:

llama stack build --template ollama --image-type venv

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label Feb 24, 2025
@leseb leseb force-pushed the fix-build-venv branch 2 times, most recently from de8c113 to 075895d Compare February 24, 2025 12:33
@leseb leseb changed the title fix: avoid failure when no special pip dependencies are present fix: avoid failure when no special pip deps and better exit Feb 24, 2025
When building providers in a virtual environment or containers, special
pip dependencies may not always be provided (e.g., for Ollama). The
check should only fail if the required number of arguments is missing.
Currently, two arguments are mandatory:

1. Environment name
2. Pip dependencies

Additionally, return statements were replaced with sys.exit(1) in error
conditions to ensure immediate termination on critical failures. Error
handling in the stack build process was also improved to guarantee the
program exits with status 1 when facing configuration issues or build
failures.

Signed-off-by: Sébastien Han <[email protected]>
@@ -32,7 +32,7 @@ container_base="$3"
build_file_path="$4"
host_build_dir="$5"
pip_dependencies="$6"
special_pip_deps="$7"
special_pip_deps="${7:-}"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in build_conda_env.sh/ build_venv.sh this is moved to before the "set -euo pipefail". Both options work, but better to align them. So, perhaps better to mimic the option in there (or change the other 2 to be like this one

@cdoern
Copy link
Contributor

cdoern commented Feb 24, 2025

do these overlap at all #1233?

@leseb
Copy link
Contributor Author

leseb commented Feb 24, 2025

do these overlap at all #1233?

Yeah, I think it'll be great to have the renaming done after this current one is merged? What do you think?

Copy link
Contributor

@cdoern cdoern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I caught some similar stuff in my other PR, so this LGTM

@terrytangyuan terrytangyuan merged commit c4987bc into meta-llama:main Feb 24, 2025
4 checks passed
@leseb leseb deleted the fix-build-venv branch February 25, 2025 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Meta Open Source bot.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants