forked from phoenix-oss/llama-stack-mirror
fix: Fixing some small issues with the build scripts (#1132)
# What does this PR do? I was encountering build issues when building my `ollama` environment using `llama stack build` ```bash llama stack build --template ollama --image-type venv Traceback (most recent call last): File "/Users/farceo/dev/llama-stack/.venv/bin/llama", line 10, in <module> sys.exit(main()) ^^^^^^ File "/Users/farceo/dev/llama-stack/llama_stack/cli/llama.py", line 46, in main parser.run(args) File "/Users/farceo/dev/llama-stack/llama_stack/cli/llama.py", line 40, in run args.func(args) File "/Users/farceo/dev/llama-stack/llama_stack/cli/stack/build.py", line 77, in _run_stack_build_command return run_stack_build_command(args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/farceo/dev/llama-stack/llama_stack/cli/stack/_build.py", line 180, in run_stack_build_command _run_stack_build_command_from_build_config( File "/Users/farceo/dev/llama-stack/llama_stack/cli/stack/_build.py", line 272, in _run_stack_build_command_from_build_config return_code = build_image( ^^^^^^^^^^^^ File "/Users/farceo/dev/llama-stack/llama_stack/distribution/build.py", line 137, in build_image return_code = run_with_pty(args) ^^^^^^^^^^^^^^^^^^ File "/Users/farceo/dev/llama-stack/llama_stack/distribution/utils/exec.py", line 22, in run_with_pty return _run_with_pty_unix(command) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/farceo/dev/llama-stack/llama_stack/distribution/utils/exec.py", line 53, in _run_with_pty_unix process = subprocess.Popen( ^^^^^^^^^^^^^^^^^ File "/Users/farceo/.local/share/uv/python/cpython-3.11.6-macos-aarch64-none/lib/python3.11/subprocess.py", line 1026, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/Users/farceo/.local/share/uv/python/cpython-3.11.6-macos-aarch64-none/lib/python3.11/subprocess.py", line 1950, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: '/Users/farceo/dev/llama-stack/llama_stack/distribution/build_venv.sh' make: *** [build-ollama] Error 1 ``` I also had to adjust the script when testing the `common.sh` file because it returned: ```bash > source llama_stack/distribution/common.sh llama_stack/distribution/common.sh:6: command not found: ^M llama_stack/distribution/common.sh:50: parse error near `\n' ``` On my branch, I ran: ```bash sed -i '' 's/\r$//' llama_stack/distribution/common.sh ``` And then I was able to successfully build the environment. [//]: # (If resolving an issue, uncomment and update the line below) [//]: # (Closes #[issue-number]) ## Test Plan N/A [//]: # (## Documentation) N/A --------- Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
This commit is contained in:
parent
af377e844d
commit
2b752df79a
2 changed files with 15 additions and 10 deletions
|
@ -10,12 +10,12 @@ cleanup() {
|
||||||
set +x
|
set +x
|
||||||
echo "Cleaning up..."
|
echo "Cleaning up..."
|
||||||
conda deactivate
|
conda deactivate
|
||||||
conda env remove --name $envname -y
|
conda env remove --name "$envname" -y
|
||||||
}
|
}
|
||||||
|
|
||||||
handle_int() {
|
handle_int() {
|
||||||
if [ -n $ENVNAME ]; then
|
if [ -n "$ENVNAME" ]; then
|
||||||
cleanup $ENVNAME
|
cleanup "$ENVNAME"
|
||||||
fi
|
fi
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
@ -23,8 +23,8 @@ handle_int() {
|
||||||
handle_exit() {
|
handle_exit() {
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo -e "\033[1;31mABORTING.\033[0m"
|
echo -e "\033[1;31mABORTING.\033[0m"
|
||||||
if [ -n $ENVNAME ]; then
|
if [ -n "$ENVNAME" ]; then
|
||||||
cleanup $ENVNAME
|
cleanup "$ENVNAME"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -33,10 +33,14 @@ setup_cleanup_handlers() {
|
||||||
trap handle_int INT
|
trap handle_int INT
|
||||||
trap handle_exit EXIT
|
trap handle_exit EXIT
|
||||||
|
|
||||||
__conda_setup="$('conda' 'shell.bash' 'hook' 2>/dev/null)"
|
if is_command_available conda; then
|
||||||
eval "$__conda_setup"
|
__conda_setup="$('conda' 'shell.bash' 'hook' 2>/dev/null)"
|
||||||
|
eval "$__conda_setup"
|
||||||
conda deactivate
|
conda deactivate
|
||||||
|
else
|
||||||
|
echo "conda is not available"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# check if a command is present
|
# check if a command is present
|
||||||
|
|
|
@ -34,6 +34,7 @@ def _run_with_pty_unix(command):
|
||||||
original_sigint = signal.getsignal(signal.SIGINT)
|
original_sigint = signal.getsignal(signal.SIGINT)
|
||||||
|
|
||||||
ctrl_c_pressed = False
|
ctrl_c_pressed = False
|
||||||
|
process = None
|
||||||
|
|
||||||
def sigint_handler(signum, frame):
|
def sigint_handler(signum, frame):
|
||||||
nonlocal ctrl_c_pressed
|
nonlocal ctrl_c_pressed
|
||||||
|
@ -98,7 +99,7 @@ def _run_with_pty_unix(command):
|
||||||
signal.signal(signal.SIGINT, original_sigint)
|
signal.signal(signal.SIGINT, original_sigint)
|
||||||
|
|
||||||
os.close(master)
|
os.close(master)
|
||||||
if process.poll() is None:
|
if process and process.poll() is None:
|
||||||
process.terminate()
|
process.terminate()
|
||||||
process.wait()
|
process.wait()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue