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: Disable krunner's user site to avoid potential conflicts with user-installed packages #1962

Merged
merged 3 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/1962.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Explicitly disable the user-site package detection in the krunner python commands to avoid potential conflicts with user-installed packages in `.local` directories
1 change: 1 addition & 0 deletions src/ai/backend/agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -1920,6 +1920,7 @@ async def create_kernel(
krunner_opts.append("--debug")
cmdargs += [
"/opt/backend.ai/bin/python",
"-s",
"-m",
"ai.backend.kernel",
*krunner_opts,
Expand Down
3 changes: 2 additions & 1 deletion src/ai/backend/kernel/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@
import msgpack
import zmq
from async_timeout import timeout
from jupyter_client import AsyncKernelClient, AsyncKernelManager
from jupyter_client.asynchronous.client import AsyncKernelClient
from jupyter_client.kernelspec import KernelSpecManager
from jupyter_client.manager import AsyncKernelManager

from .compat import current_loop
from .intrinsic import (
Expand Down
8 changes: 4 additions & 4 deletions src/ai/backend/runner/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ if [ $USER_ID -eq 0 ]; then
fi

# Extract dotfiles
/opt/backend.ai/bin/python /opt/kernel/extract_dotfiles.py
/opt/backend.ai/bin/python -s /opt/kernel/extract_dotfiles.py

# Start ssh-agent if it is available
if command -v ssh-agent > /dev/null; then
Expand All @@ -47,7 +47,7 @@ if [ $USER_ID -eq 0 ]; then

echo "Generate random alpha-numeric password"
if [ ! -f "$HOME/.password" ]; then
/opt/backend.ai/bin/python /opt/kernel/fantompass.py > "$HOME/.password"
/opt/backend.ai/bin/python -s /opt/kernel/fantompass.py > "$HOME/.password"
export ALPHA_NUMERIC_VAL=$(cat $HOME/.password)
chmod 0644 "$HOME/.password"
echo "work:$ALPHA_NUMERIC_VAL" | chpasswd
Expand Down Expand Up @@ -114,7 +114,7 @@ else
chown $USER_ID:$GROUP_ID /opt/kernel/agent.sock

# Extract dotfiles
/opt/kernel/su-exec $USER_ID:$GROUP_ID /opt/backend.ai/bin/python /opt/kernel/extract_dotfiles.py
/opt/kernel/su-exec $USER_ID:$GROUP_ID /opt/backend.ai/bin/python -s /opt/kernel/extract_dotfiles.py

# Start ssh-agent if it is available
if command -v ssh-agent > /dev/null; then
Expand All @@ -129,7 +129,7 @@ else

echo "Generate random alpha-numeric password"
if [ ! -f "$HOME/.password" ]; then
/opt/kernel/su-exec $USER_ID:$GROUP_ID /opt/backend.ai/bin/python /opt/kernel/fantompass.py > "$HOME/.password"
/opt/kernel/su-exec $USER_ID:$GROUP_ID /opt/backend.ai/bin/python -s /opt/kernel/fantompass.py > "$HOME/.password"
export ALPHA_NUMERIC_VAL=$(cat $HOME/.password)
chmod 0644 "$HOME/.password"
echo "$USER_NAME:$ALPHA_NUMERIC_VAL" | chpasswd
Expand Down
Loading