Skip to content

Commit 3db684d

Browse files
committed
shell format fixed
Signed-off-by: sharvil10 <sharvil.shah@intel.com>
1 parent 896ea01 commit 3db684d

File tree

6 files changed

+134
-131
lines changed

6 files changed

+134
-131
lines changed

enterprise/redhat/openshift-ai/gaudi/docker/builder/run

+23-23
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,32 @@ APP_ROOT=${APP_ROOT:-/opt/app-root}
88

99
# Pre-clone repositories defined in JUPYTER_PRELOAD_REPOS
1010
if [ -n "${JUPYTER_PRELOAD_REPOS}" ]; then
11-
for repo in $(echo "${JUPYTER_PRELOAD_REPOS}" | tr ',' ' '); do
12-
# Check for the presence of "@branch" in the repo string
13-
REPO_BRANCH=$(echo "${repo}" | cut -s -d'@' -f2)
14-
if [[ -n ${REPO_BRANCH} ]]; then
15-
# Remove the branch from the repo string and convert REPO_BRANCH to git clone arg
16-
repo=$(echo "${repo}" | cut -d'@' -f1)
17-
REPO_BRANCH="-b ${REPO_BRANCH}"
18-
fi
19-
echo "Checking if repository $repo exists locally"
20-
REPO_DIR=$(basename "${repo}")
21-
if [ -d "${REPO_DIR}" ]; then
22-
pushd "${REPO_DIR}"
23-
# Do nothing if the repo already exists
24-
echo "The ${repo} has already been cloned"
25-
:
26-
popd
27-
else
28-
GIT_SSL_NO_VERIFY=true git clone "${repo}" "${REPO_DIR}" "${REPO_BRANCH}"
29-
fi
30-
done
11+
for repo in $(echo "${JUPYTER_PRELOAD_REPOS}" | tr ',' ' '); do
12+
# Check for the presence of "@branch" in the repo string
13+
REPO_BRANCH=$(echo "${repo}" | cut -s -d'@' -f2)
14+
if [[ -n ${REPO_BRANCH} ]]; then
15+
# Remove the branch from the repo string and convert REPO_BRANCH to git clone arg
16+
repo=$(echo "${repo}" | cut -d'@' -f1)
17+
REPO_BRANCH="-b ${REPO_BRANCH}"
18+
fi
19+
echo "Checking if repository $repo exists locally"
20+
REPO_DIR=$(basename "${repo}")
21+
if [ -d "${REPO_DIR}" ]; then
22+
pushd "${REPO_DIR}"
23+
# Do nothing if the repo already exists
24+
echo "The ${repo} has already been cloned"
25+
:
26+
popd
27+
else
28+
GIT_SSL_NO_VERIFY=true git clone "${repo}" "${REPO_DIR}" "${REPO_BRANCH}"
29+
fi
30+
done
3131
fi
3232

3333
if [ -n "${NOTEBOOK_SAMPLES_LINK}" ]; then
34-
for link in $(echo "${NOTEBOOK_SAMPLES_LINK}" | tr ',' ' '); do
35-
wget "${link}"
36-
done
34+
for link in $(echo "${NOTEBOOK_SAMPLES_LINK}" | tr ',' ' '); do
35+
wget "${link}"
36+
done
3737
fi
3838

3939
"${APP_ROOT}"/bin/start-notebook.sh "$@"

enterprise/redhat/openshift-ai/gaudi/docker/install-python310.sh

+63-63
Original file line numberDiff line numberDiff line change
@@ -20,47 +20,47 @@ _SSL_LIB=""
2020

2121
# preinstall dependencies and define variables
2222
case "${_BASE_NAME}" in
23-
*ubuntu22.04*)
24-
echo "Skip install Python3.10 from source on Ubuntu22.04"
25-
exit 0;
26-
;;
27-
*debian* | *ubuntu*)
28-
apt update
29-
apt install -y libsqlite3-dev libreadline-dev
30-
;;
31-
*rhel*)
32-
yum install -y sqlite-devel readline-devel xz-devel
33-
;;
34-
*tencentos3.1*)
35-
dnf install -y sqlite-devel readline-devel zlib-devel xz-devel bzip2-devel libffi-devel
36-
wget -nv -O /opt/openssl-1.1.1w.tar.gz https://github.com/openssl/openssl/releases/download/OpenSSL_1_1_1w/openssl-1.1.1w.tar.gz && \
37-
cd /opt/ && \
38-
tar xzf openssl-1.1.1w.tar.gz && \
39-
rm -rf openssl-1.1.1w.tar.gz && \
40-
cd openssl-1.1.1w && \
41-
./config --prefix=/usr/local/openssl-1.1.1w shared zlib && \
42-
make && make install
43-
ln -s /etc/pki/tls/cert.pem /usr/local/openssl-1.1.1w/ssl/cert.pem
23+
*ubuntu22.04*)
24+
echo "Skip install Python3.10 from source on Ubuntu22.04"
25+
exit 0
26+
;;
27+
*debian* | *ubuntu*)
28+
apt update
29+
apt install -y libsqlite3-dev libreadline-dev
30+
;;
31+
*rhel*)
32+
yum install -y sqlite-devel readline-devel xz-devel
33+
;;
34+
*tencentos3.1*)
35+
dnf install -y sqlite-devel readline-devel zlib-devel xz-devel bzip2-devel libffi-devel
36+
wget -nv -O /opt/openssl-1.1.1w.tar.gz https://github.com/openssl/openssl/releases/download/OpenSSL_1_1_1w/openssl-1.1.1w.tar.gz &&
37+
cd /opt/ &&
38+
tar xzf openssl-1.1.1w.tar.gz &&
39+
rm -rf openssl-1.1.1w.tar.gz &&
40+
cd openssl-1.1.1w &&
41+
./config --prefix=/usr/local/openssl-1.1.1w shared zlib &&
42+
make && make install
43+
ln -s /etc/pki/tls/cert.pem /usr/local/openssl-1.1.1w/ssl/cert.pem
4444

45-
PATH=$PATH:/usr/local/protoc/bin:/usr/local/openssl-1.1.1w/bin
46-
LD_LIBRARY_PATH=/usr/local/openssl-1.1.1w/lib:$LD_LIBRARY_PATH
47-
_SSL_LIB="--with-openssl=/usr/local/openssl-1.1.1w"
48-
;;
49-
*amzn2*)
50-
yum install -y sqlite-devel readline-devel
51-
wget -nv -O /opt/openssl-1.1.1w.tar.gz https://github.com/openssl/openssl/releases/download/OpenSSL_1_1_1w/openssl-1.1.1w.tar.gz && \
52-
cd /opt/ && \
53-
tar xzf openssl-1.1.1w.tar.gz && \
54-
rm -rf openssl-1.1.1w.tar.gz && \
55-
cd openssl-1.1.1w && \
56-
./config --prefix=/usr/local/openssl-1.1.1w shared zlib && \
57-
make && make install
58-
ln -s /etc/pki/tls/cert.pem /usr/local/openssl-1.1.1w/ssl/cert.pem
45+
PATH=$PATH:/usr/local/protoc/bin:/usr/local/openssl-1.1.1w/bin
46+
LD_LIBRARY_PATH=/usr/local/openssl-1.1.1w/lib:$LD_LIBRARY_PATH
47+
_SSL_LIB="--with-openssl=/usr/local/openssl-1.1.1w"
48+
;;
49+
*amzn2*)
50+
yum install -y sqlite-devel readline-devel
51+
wget -nv -O /opt/openssl-1.1.1w.tar.gz https://github.com/openssl/openssl/releases/download/OpenSSL_1_1_1w/openssl-1.1.1w.tar.gz &&
52+
cd /opt/ &&
53+
tar xzf openssl-1.1.1w.tar.gz &&
54+
rm -rf openssl-1.1.1w.tar.gz &&
55+
cd openssl-1.1.1w &&
56+
./config --prefix=/usr/local/openssl-1.1.1w shared zlib &&
57+
make && make install
58+
ln -s /etc/pki/tls/cert.pem /usr/local/openssl-1.1.1w/ssl/cert.pem
5959

60-
PATH=$PATH:/usr/local/protoc/bin:/usr/local/openssl-1.1.1w/bin
61-
LD_LIBRARY_PATH=/usr/local/openssl-1.1.1w/lib:$LD_LIBRARY_PATH
62-
_SSL_LIB="--with-openssl=/usr/local/openssl-1.1.1w"
63-
;;
60+
PATH=$PATH:/usr/local/protoc/bin:/usr/local/openssl-1.1.1w/bin
61+
LD_LIBRARY_PATH=/usr/local/openssl-1.1.1w/lib:$LD_LIBRARY_PATH
62+
_SSL_LIB="--with-openssl=/usr/local/openssl-1.1.1w"
63+
;;
6464
esac
6565

6666
# install Python
@@ -74,30 +74,30 @@ make -j && make altinstall
7474

7575
# post install
7676
case "${_BASE_NAME}" in
77-
*rhel9*)
78-
alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.10 2 && \
79-
alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1 && \
80-
alternatives --set python3 /usr/local/bin/python3.10
81-
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
82-
;;
83-
*tencentos3.1*)
84-
alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.10 4 && \
85-
alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 3 && \
86-
alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 2 && \
87-
alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1 && \
88-
alternatives --set python3 /usr/local/bin/python3.10
89-
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
90-
;;
91-
*amzn2*)
92-
update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.10 3 && \
93-
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 2 && \
94-
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1
95-
;;
96-
*debian*)
97-
update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.10 3
98-
update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.8 2
99-
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1
100-
;;
77+
*rhel9*)
78+
alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.10 2 &&
79+
alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1 &&
80+
alternatives --set python3 /usr/local/bin/python3.10
81+
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
82+
;;
83+
*tencentos3.1*)
84+
alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.10 4 &&
85+
alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 3 &&
86+
alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 2 &&
87+
alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1 &&
88+
alternatives --set python3 /usr/local/bin/python3.10
89+
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
90+
;;
91+
*amzn2*)
92+
update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.10 3 &&
93+
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 2 &&
94+
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1
95+
;;
96+
*debian*)
97+
update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.10 3
98+
update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.8 2
99+
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1
100+
;;
101101
esac
102102

103103
python3 -m pip install --upgrade pip setuptools

enterprise/redhat/openshift-ai/gaudi/docker/install_efa.sh

+12-9
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,18 @@ wget -nv https://efa-installer.amazonaws.com/aws-efa-installer-"$efa_installer_v
2222
tar -xf "$tmp_dir"/aws-efa-installer-"$efa_installer_version".tar.gz -C "$tmp_dir"
2323
pushd "$tmp_dir"/aws-efa-installer
2424
# shellcheck disable=SC1091
25-
case $(. /etc/os-release ; echo -n "$ID") in
26-
rhel)
27-
# we cannot install dkms packages on RHEL images due to OCP rules
28-
rm -f RPMS/RHEL8/x86_64/dkms*.rpm
29-
;;
30-
tencentos)
31-
dnf install -y RPMS/ROCKYLINUX8/x86_64/rdma-core/libibverbs-46.0-1.el8.x86_64.rpm RPMS/ROCKYLINUX8/x86_64/rdma-core/libibverbs-utils-46.0-1.el8.x86_64.rpm
32-
patch -f -p1 -i /tmp/tencentos_efa_patch.txt --reject-file=tencentos_efa_patch.rej --no-backup-if-mismatch
33-
;;
25+
case $(
26+
. /etc/os-release
27+
echo -n "$ID"
28+
) in
29+
rhel)
30+
# we cannot install dkms packages on RHEL images due to OCP rules
31+
rm -f RPMS/RHEL8/x86_64/dkms*.rpm
32+
;;
33+
tencentos)
34+
dnf install -y RPMS/ROCKYLINUX8/x86_64/rdma-core/libibverbs-46.0-1.el8.x86_64.rpm RPMS/ROCKYLINUX8/x86_64/rdma-core/libibverbs-utils-46.0-1.el8.x86_64.rpm
35+
patch -f -p1 -i /tmp/tencentos_efa_patch.txt --reject-file=tencentos_efa_patch.rej --no-backup-if-mismatch
36+
;;
3437
esac
3538
./efa_installer.sh -y --skip-kmod --skip-limit-conf --no-verify
3639
popd

enterprise/redhat/openshift-ai/gaudi/docker/install_packages.sh

+15-15
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,21 @@ set -ex
1818
pt_package_name="pytorch_modules-v${PT_VERSION}_${VERSION}_${REVISION}.tgz"
1919
os_string="ubuntu${OS_NUMBER}"
2020
case "${BASE_NAME}" in
21-
*rhel9.2*)
22-
os_string="rhel92"
23-
;;
24-
*rhel9.4*)
25-
os_string="rhel94"
26-
;;
27-
*rhel8*)
28-
os_string="rhel86"
29-
;;
30-
*amzn2*)
31-
os_string="amzn2"
32-
;;
33-
*tencentos*)
34-
os_string="tencentos31"
35-
;;
21+
*rhel9.2*)
22+
os_string="rhel92"
23+
;;
24+
*rhel9.4*)
25+
os_string="rhel94"
26+
;;
27+
*rhel8*)
28+
os_string="rhel86"
29+
;;
30+
*amzn2*)
31+
os_string="amzn2"
32+
;;
33+
*tencentos*)
34+
os_string="tencentos31"
35+
;;
3636
esac
3737
pt_artifact_path="https://${ARTIFACTORY_URL}/artifactory/gaudi-pt-modules/${VERSION}/${REVISION}/pytorch/${os_string}"
3838

enterprise/redhat/openshift-ai/gaudi/docker/start-notebook.sh

+10-10
Original file line numberDiff line numberDiff line change
@@ -20,40 +20,40 @@ SCRIPT_DIR=${APP_ROOT}/bin
2020
source "${SCRIPT_DIR}"/utils/process.sh
2121

2222
if [ -f "${SCRIPT_DIR}/utils/setup-elyra.sh" ]; then
23-
# shellcheck disable=SC1091
24-
source "${SCRIPT_DIR}"/utils/setup-elyra.sh
23+
# shellcheck disable=SC1091
24+
source "${SCRIPT_DIR}"/utils/setup-elyra.sh
2525
fi
2626

2727
# Initialize notebooks arguments variable
2828
NOTEBOOK_PROGRAM_ARGS=""
2929

3030
# Set default ServerApp.port value if NOTEBOOK_PORT variable is defined
3131
if [ -n "${NOTEBOOK_PORT}" ]; then
32-
NOTEBOOK_PROGRAM_ARGS+="--ServerApp.port=${NOTEBOOK_PORT} "
32+
NOTEBOOK_PROGRAM_ARGS+="--ServerApp.port=${NOTEBOOK_PORT} "
3333
fi
3434

3535
# Set default ServerApp.base_url value if NOTEBOOK_BASE_URL variable is defined
3636
if [ -n "${NOTEBOOK_BASE_URL}" ]; then
37-
NOTEBOOK_PROGRAM_ARGS+="--ServerApp.base_url=${NOTEBOOK_BASE_URL} "
37+
NOTEBOOK_PROGRAM_ARGS+="--ServerApp.base_url=${NOTEBOOK_BASE_URL} "
3838
fi
3939

4040
# Set default ServerApp.root_dir value if NOTEBOOK_ROOT_DIR variable is defined
4141
if [ -n "${NOTEBOOK_ROOT_DIR}" ]; then
42-
NOTEBOOK_PROGRAM_ARGS+="--ServerApp.root_dir=${NOTEBOOK_ROOT_DIR} "
42+
NOTEBOOK_PROGRAM_ARGS+="--ServerApp.root_dir=${NOTEBOOK_ROOT_DIR} "
4343
else
44-
NOTEBOOK_PROGRAM_ARGS+="--ServerApp.root_dir=${HOME} "
44+
NOTEBOOK_PROGRAM_ARGS+="--ServerApp.root_dir=${HOME} "
4545
fi
4646

4747
# Add additional arguments if NOTEBOOK_ARGS variable is defined
4848
if [ -n "${NOTEBOOK_ARGS}" ]; then
49-
NOTEBOOK_PROGRAM_ARGS+=${NOTEBOOK_ARGS}
49+
NOTEBOOK_PROGRAM_ARGS+=${NOTEBOOK_ARGS}
5050
fi
5151

5252
echo "${NOTEBOOK_PROGRAM_ARGS}"
5353

5454
# Start the JupyterLab notebook
5555
# shellcheck disable=SC2086
5656
start_process jupyter lab ${NOTEBOOK_PROGRAM_ARGS} \
57-
--ServerApp.ip=0.0.0.0 \
58-
--ServerApp.allow_origin="*" \
59-
--ServerApp.open_browser=False
57+
--ServerApp.ip=0.0.0.0 \
58+
--ServerApp.allow_origin="*" \
59+
--ServerApp.open_browser=False

enterprise/redhat/openshift-ai/gaudi/docker/utils/process.sh

+11-11
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,20 @@
1515
# limitations under the License.
1616

1717
function start_process() {
18-
trap stop_process TERM INT
18+
trap stop_process TERM INT
1919

20-
echo "Running command:" "$@"
21-
echo -e "$@"
22-
"$@" &
20+
echo "Running command:" "$@"
21+
echo -e "$@"
22+
"$@" &
2323

24-
PID=$!
25-
wait $PID
26-
trap - TERM INT
27-
wait $PID
28-
STATUS=$?
29-
exit $STATUS
24+
PID=$!
25+
wait $PID
26+
trap - TERM INT
27+
wait $PID
28+
STATUS=$?
29+
exit $STATUS
3030
}
3131

3232
function stop_process() {
33-
kill -TERM "$PID"
33+
kill -TERM "$PID"
3434
}

0 commit comments

Comments
 (0)