Skip to content

Commit d6b94b2

Browse files
authored
Refresh jobs images, fix key issue for cuda install, updated optcl tests (#241)
1 parent 7f49d7e commit d6b94b2

File tree

7 files changed

+145
-101
lines changed

7 files changed

+145
-101
lines changed

.gitleaks.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ useDefault = true
99
# Paths listed in allowlist will not be scanned.
1010
[allowlist]
1111
description = "Global allow list"
12-
stopwords = ["test_password", "sample_key"]
1312
regexes = [
1413
'''example-password''',
1514
'''this-is-not-the-secret''',
16-
'''<redacted>'''
15+
'''<redacted>''',
16+
# NVIDIA_GPGKEY_SUM from public documentation:
17+
# https://gitlab.com/nvidia/container-images/cuda/-/blob/master/dist/10.1/centos7/base/Dockerfile
18+
'''d0664fbbdb8c32356d45de36c5984617217b2d0bef41b93ccecd326ba3b80c87'''
1719
]
1820
paths = [
1921
'''tests/integration/tests_configs.yaml'''

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ repos:
3939
- id: gitleaks
4040
# Oracle copyright checker
4141
- repo: https://github.com/oracle-samples/oci-data-science-ai-samples/
42-
rev: cbe0136
42+
rev: cbe0136f7aaffe463b31ddf3f34b0e16b4b124ff
4343
hooks:
4444
- id: check-copyright
4545
name: check-copyright

ads/opctl/docker/Dockerfile.job

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# Copyright (c) 2021 Oracle and/or its affiliates.
1+
# Copyright (c) 2021, 2023 Oracle and/or its affiliates.
22
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
33

4-
FROM --platform=linux/amd64 ghcr.io/oracle/oraclelinux:7-slim
4+
FROM ghcr.io/oracle/oraclelinux:7-slim
55

66
# Configure environment
77
ENV DATASCIENCE_USER datascience
@@ -10,16 +10,20 @@ ENV HOME /home/$DATASCIENCE_USER
1010
ENV DATASCIENCE_INSTALL_DIR /etc/datascience
1111
ENV LOGS_DIRECTORY /logs
1212

13+
ARG release=19
14+
ARG update=13
15+
1316
RUN \
14-
yum -y -q install oracle-release-el7 deltarpm && \
17+
yum -y -q install oracle-release-el7 && \
1518
yum-config-manager --add-repo http://yum.oracle.com/repo/OracleLinux/OL7/developer_EPEL/x86_64 && \
1619
yum-config-manager --enable ol7_optional_latest --enable ol7_addons --enable ol7_software_collections --enable ol7_oracle_instantclient > /dev/null && \
17-
yum install -y -q \
18-
build-essential \
20+
yum groupinstall -y -q 'Development Tools' && \
21+
yum update -y && \
22+
yum install -y --setopt=skip_missing_names_on_install=False \
1923
bzip2 \
2024
curl \
2125
git \
22-
gfortran \
26+
gcc-gfortran \
2327
libcurl-devel \
2428
libxml2-devel \
2529
oracle-instantclient${release}.${update}-basic \
@@ -30,15 +34,12 @@ RUN \
3034
sudo \
3135
unzip \
3236
zip \
33-
g++ \
37+
gcc-c++ \
3438
wget \
3539
gcc \
36-
vim \
37-
yum groupinstall -y -q development tools \
3840
&& yum clean all \
3941
&& rm -rf /var/cache/yum/*
4042

41-
4243
# setup user
4344
RUN \
4445
mkdir -p /home/$DATASCIENCE_USER && \
@@ -49,8 +50,6 @@ RUN \
4950
mkdir -p $DATASCIENCE_INSTALL_DIR && chown $DATASCIENCE_USER $DATASCIENCE_INSTALL_DIR && \
5051
mkdir -p $LOGS_DIRECTORY && chown -R $DATASCIENCE_USER:users $LOGS_DIRECTORY && \
5152
mkdir -p $LOGS_DIRECTORY/harness && chown -R $DATASCIENCE_USER:users $LOGS_DIRECTORY/harness
52-
# mkdir -p /home/$DATASCIENCE_USER/condapack
53-
5453

5554
RUN mkdir -p /etc/datascience/build
5655
RUN mkdir -p $DATASCIENCE_INSTALL_DIR/{pre-build-ds,post-build-ds,pre-run-ds,pre-run-user}
@@ -62,15 +61,13 @@ ENV LANG=$LANG
6261
ENV SHELL=/bin/bash
6362

6463
# set /opt folder permissions for $DATASCIENCE_USER. Conda is going to live in this folder.
65-
RUN chown $DATASCIENCE_USER /opt
64+
RUN chown -R $DATASCIENCE_USER /opt
6665

6766
USER $DATASCIENCE_USER
6867
WORKDIR /home/datascience
69-
RUN curl -L https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh >> /home/datascience/miniconda.sh \
68+
RUN wget -nv https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /home/datascience/miniconda.sh \
7069
&& /bin/bash /home/datascience/miniconda.sh -f -b -p /opt/conda \
7170
&& rm /home/datascience/miniconda.sh \
72-
&& ls /opt/**/* \
73-
&& /opt/conda/bin/conda install python=3.8 anaconda \
7471
&& /opt/conda/bin/conda clean -yaf
7572

7673
WORKDIR /
@@ -82,10 +79,8 @@ USER $DATASCIENCE_USER
8279
ENV PATH="/opt/conda/bin:${PATH}"
8380
WORKDIR /home/datascience
8481

85-
86-
#COPY base-env.yaml /opt/base-env.yaml
87-
#RUN conda env update -q -n root -f /opt/base-env.yaml && conda clean -yaf && rm -rf /home/datascience/.cache/pip
88-
82+
COPY docker/base-env.yaml /opt/base-env.yaml
83+
RUN conda env update -q -n root -f /opt/base-env.yaml && conda clean -yaf && rm -rf /home/datascience/.cache/pip
8984

9085
USER $DATASCIENCE_USER
9186

@@ -97,20 +92,17 @@ RUN conda list
9792

9893
USER root
9994

95+
ARG PIP_INDEX_URL
96+
10097
############# Setup Conda environment tools ###########################
10198
ARG RAND=1
10299

103-
RUN pip install conda_pack oci-cli
104-
105100
ARG RUN_WORKING_DIR="/home/datascience"
106101
WORKDIR $RUN_WORKING_DIR
107102

108103
# clean tmp folder
109104
RUN rm -rf /tmp/*
110105

111-
#COPY harness.py /etc/datascience/harness.py
112106
RUN mkdir -p /etc/datascience/operators
113-
# Temporarily removing operators related components
114-
# COPY operators/run.py /etc/datascience/operators/run.py
115107

116108
USER datascience

ads/opctl/docker/Dockerfile.job.gpu

Lines changed: 49 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2021 Oracle and/or its affiliates.
1+
# Copyright (c) 2021, 2023 Oracle and/or its affiliates.
22
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
33

44
FROM ghcr.io/oracle/oraclelinux:7-slim
@@ -8,18 +8,21 @@ ENV DATASCIENCE_USER datascience
88
ENV DATASCIENCE_UID 1000
99
ENV HOME /home/$DATASCIENCE_USER
1010
ENV DATASCIENCE_INSTALL_DIR /etc/datascience
11-
ENV LOGS_DIRECTORY /logs
11+
12+
ARG release=19
13+
ARG update=13
1214

1315
RUN \
14-
yum -y -q install oracle-release-el7 deltarpm && \
16+
yum -y -q install oracle-release-el7 && \
1517
yum-config-manager --add-repo http://yum.oracle.com/repo/OracleLinux/OL7/developer_EPEL/x86_64 && \
1618
yum-config-manager --enable ol7_optional_latest --enable ol7_addons --enable ol7_software_collections --enable ol7_oracle_instantclient > /dev/null && \
17-
yum install -y -q \
18-
build-essential \
19+
yum groupinstall -y -q 'Development Tools' && \
20+
yum update -y && \
21+
yum install -y --setopt=skip_missing_names_on_install=False \
1922
bzip2 \
2023
curl \
2124
git \
22-
gfortran \
25+
gcc-gfortran \
2326
libcurl-devel \
2427
libxml2-devel \
2528
oracle-instantclient${release}.${update}-basic \
@@ -30,22 +33,20 @@ RUN \
3033
sudo \
3134
unzip \
3235
zip \
33-
g++ \
36+
gcc-c++ \
3437
wget \
3538
gcc \
36-
vim \
37-
yum groupinstall -y -q development tools \
3839
&& yum clean all \
3940
&& rm -rf /var/cache/yum/*
4041

4142
########################### CUDA INSTALLATION ########################################
4243

43-
#Reference: https://gitlab.com/nvidia/container-images/cuda/-/blob/master/dist/centos7/10.1/runtime/cudnn7/Dockerfile
44-
#Reference: https://gitlab.com/nvidia/container-images/cuda/-/blob/master/dist/centos7/10.1/runtime/Dockerfile
45-
#Reference: https://gitlab.com/nvidia/container-images/cuda/-/blob/master/dist/centos7/10.1/base/Dockerfile
44+
#Reference: https://gitlab.com/nvidia/container-images/cuda/-/blob/master/dist/10.1/centos7/runtime/cudnn7/Dockerfile
45+
#Reference: https://gitlab.com/nvidia/container-images/cuda/-/blob/master/dist/10.1/centos7/runtime/Dockerfile
46+
#Reference: https://gitlab.com/nvidia/container-images/cuda/-/blob/master/dist/10.1/centos7/base/Dockerfile
4647

47-
RUN NVIDIA_GPGKEY_SUM=d1be581509378368edeec8c1eb2958702feedf3bc3d17011adbf24efacce4ab5 && \
48-
curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/7fa2af80.pub | sed '/^Version/d' > /etc/pki/rpm-gpg/RPM-GPG-KEY-NVIDIA && \
48+
RUN NVIDIA_GPGKEY_SUM=d0664fbbdb8c32356d45de36c5984617217b2d0bef41b93ccecd326ba3b80c87 && \
49+
curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/D42D0685.pub | sed '/^Version/d' > /etc/pki/rpm-gpg/RPM-GPG-KEY-NVIDIA && \
4950
echo "$NVIDIA_GPGKEY_SUM /etc/pki/rpm-gpg/RPM-GPG-KEY-NVIDIA" | sha256sum -c --strict -
5051

5152
COPY docker/cuda.repo /etc/yum.repos.d/cuda.repo
@@ -66,7 +67,7 @@ RUN echo "/usr/local/nvidia/lib" >> /etc/ld.so.conf.d/nvidia.conf && \
6667
echo "/usr/local/nvidia/lib64" >> /etc/ld.so.conf.d/nvidia.conf
6768

6869
ENV PATH /usr/local/nvidia/bin:/usr/local/cuda/bin:${PATH}
69-
ENV LD_LIBRARY_PATH /usr/local/nvidia/lib:/usr/local/nvidia/lib64
70+
ENV LD_LIBRARY_PATH /lib64:/usr/local/nvidia/lib:/usr/local/nvidia/lib64
7071

7172
# nvidia-container-runtime
7273
ENV NVIDIA_VISIBLE_DEVICES all
@@ -83,19 +84,14 @@ RUN CUDNN_DOWNLOAD_SUM=7eaec8039a2c30ab0bc758d303588767693def6bf49b22485a2c00bf2
8384
rm cudnn-10.1-linux-x64-v7.6.5.32.tgz && \
8485
ldconfig
8586

86-
8787
# setup user
8888
RUN \
8989
mkdir -p /home/$DATASCIENCE_USER && \
9090
useradd -m -s /bin/bash -N -u $DATASCIENCE_UID $DATASCIENCE_USER && \
9191
chown -R $DATASCIENCE_USER /home/$DATASCIENCE_USER && \
9292
chown -R $DATASCIENCE_USER:users /usr/local/ && \
9393
touch /etc/sudoers.d/$DATASCIENCE_USER && echo "$DATASCIENCE_USER ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers.d/$DATASCIENCE_USER && \
94-
mkdir -p $DATASCIENCE_INSTALL_DIR && chown $DATASCIENCE_USER $DATASCIENCE_INSTALL_DIR && \
95-
mkdir -p $LOGS_DIRECTORY && chown -R $DATASCIENCE_USER:users $LOGS_DIRECTORY && \
96-
mkdir -p $LOGS_DIRECTORY/harness && chown -R $DATASCIENCE_USER:users $LOGS_DIRECTORY/harness
97-
# mkdir -p /home/$DATASCIENCE_USER/condapack
98-
94+
mkdir -p $DATASCIENCE_INSTALL_DIR && chown $DATASCIENCE_USER $DATASCIENCE_INSTALL_DIR
9995

10096
RUN mkdir -p /etc/datascience/build
10197
RUN mkdir -p $DATASCIENCE_INSTALL_DIR/{pre-build-ds,post-build-ds,pre-run-ds,pre-run-user}
@@ -107,15 +103,13 @@ ENV LANG=$LANG
107103
ENV SHELL=/bin/bash
108104

109105
# set /opt folder permissions for $DATASCIENCE_USER. Conda is going to live in this folder.
110-
RUN chown $DATASCIENCE_USER /opt
106+
RUN chown -R $DATASCIENCE_USER /opt
111107

112108
USER $DATASCIENCE_USER
113109
WORKDIR /home/datascience
114-
RUN curl -L https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh >> /home/datascience/miniconda.sh \
110+
RUN wget -nv https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /home/datascience/miniconda.sh \
115111
&& /bin/bash /home/datascience/miniconda.sh -f -b -p /opt/conda \
116112
&& rm /home/datascience/miniconda.sh \
117-
&& ls /opt/**/* \
118-
&& /opt/conda/bin/conda install python=3.8 anaconda \
119113
&& /opt/conda/bin/conda clean -yaf
120114

121115
WORKDIR /
@@ -127,10 +121,8 @@ USER $DATASCIENCE_USER
127121
ENV PATH="/opt/conda/bin:${PATH}"
128122
WORKDIR /home/datascience
129123

130-
131-
#COPY base-env.yaml /opt/base-env.yaml
132-
#RUN conda env update -q -n root -f /opt/base-env.yaml && conda clean -yaf && rm -rf /home/datascience/.cache/pip
133-
124+
COPY docker/base-env.yaml /opt/base-env.yaml
125+
RUN conda env update -q -n root -f /opt/base-env.yaml && conda clean -yaf && rm -rf /home/datascience/.cache/pip
134126

135127
USER $DATASCIENCE_USER
136128

@@ -142,20 +134,43 @@ RUN conda list
142134

143135
USER root
144136

137+
ARG PIP_INDEX_URL
138+
145139
############# Setup Conda environment tools ###########################
146140
ARG RAND=1
147141

148-
RUN pip install conda_pack oci-cli
149-
150142
ARG RUN_WORKING_DIR="/home/datascience"
151143
WORKDIR $RUN_WORKING_DIR
152144

145+
RUN ln -s /opt/conda/lib/libnvrtc.so.10.0.130 /opt/conda/lib/libnvrtc.so.10 && \
146+
ln -s /opt/conda/lib/libnvrtc-builtins.so.10.0.130 /opt/conda/lib/libnvrtc-builtins.so.10 && \
147+
ln -s /opt/conda/lib/libnvgraph.so.10.0.130 /opt/conda/lib/libnvgraph.so.10 && \
148+
ln -s /opt/conda/lib/libnvblas.so.10.0.130 /opt/conda/lib/libnvblas.so.10 && \
149+
ln -s /opt/conda/lib/libnpps.so.10.0.130 /opt/conda/lib/libnpps.so.10 && \
150+
ln -s /opt/conda/lib/libnppitc.so.10.0.130 /opt/conda/lib/libnppitc.so.10 && \
151+
ln -s /opt/conda/lib/libnppisu.so.10.0.130 /opt/conda/lib/libnppisu.so.10 && \
152+
ln -s /opt/conda/lib/libnppist.so.10.0.130 /opt/conda/lib/libnppist.so.10 && \
153+
ln -s /opt/conda/lib/libnppim.so.10.0.130 /opt/conda/lib/libnppim.so.10 && \
154+
ln -s /opt/conda/lib/libnppig.so.10.0.130 /opt/conda/lib/libnppig.so.10 && \
155+
ln -s /opt/conda/lib/libnppif.so.10.0.130 /opt/conda/lib/libnppif.so.10 && \
156+
ln -s /opt/conda/lib/libnppidei.so.10.0.130 /opt/conda/lib/libnppidei.so.10 && \
157+
ln -s /opt/conda/lib/libnppicom.so.10.0.130 /opt/conda/lib/libnppicom.so.10 && \
158+
ln -s /opt/conda/lib/libnppicc.so.10.0.130 /opt/conda/lib/libnppicc.so.10 && \
159+
ln -s /opt/conda/lib/libnppial.so.10.0.130 /opt/conda/lib/libnppial.so.10 && \
160+
ln -s /opt/conda/lib/libnppc.so.10.0.130 /opt/conda/lib/libnppc.so.10 && \
161+
ln -s /opt/conda/lib/libcusparse.so.10.0.130 /opt/conda/lib/libcusparse.so.10 && \
162+
ln -s /opt/conda/lib/libcusolver.so.10.0.130 /opt/conda/lib/libcusolver.so.10 && \
163+
ln -s /opt/conda/lib/libcurand.so.10.0.130 /opt/conda/lib/libcurand.so.10 && \
164+
ln -s /opt/conda/lib/libcufftw.so.10.0.145 /opt/conda/lib/libcufftw.so.10 && \
165+
ln -s /opt/conda/lib/libcufft.so.10.0.145 /opt/conda/lib/libcufft.so.10 && \
166+
ln -s /opt/conda/lib/libcudart.so.10.0.130 /opt/conda/lib/libcudart.so.10 && \
167+
ln -s /opt/conda/lib/libcublas.so.10.0.130 /opt/conda/lib/libcublas.so.10
168+
169+
ENV LD_LIBRARY_PATH $LD_LIBRARY_PATH:/opt/conda/lib
170+
153171
# clean tmp folder
154172
RUN rm -rf /tmp/*
155173

156-
#COPY harness.py /etc/datascience/harness.py
157174
RUN mkdir -p /etc/datascience/operators
158-
# Temporarily removing operators related components
159-
# COPY operators/run.py /etc/datascience/operators/run.py
160175

161176
USER datascience

ads/opctl/docker/base-env.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
channels:
2+
- nodefaults
3+
- conda-forge
4+
dependencies:
5+
- main::pip
6+
- main::python==3.8.16
7+
- main::PyYAML=5.4.1
8+
- main::cffi>=1.15.1
9+
- pip:
10+
- PyYAML==5.4.1
11+
- oci
12+
- oci-cli
13+
- conda-pack

tests/unitary/with_extras/opctl/test_opctl_local_backend.py

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818

1919

2020
class TestLocalBackend:
21-
@pytest.mark.opctl
2221
def test_init_vscode_conda(self):
2322
with tempfile.TemporaryDirectory() as td:
2423
backend = LocalBackend(
2524
{
2625
"execution": {
26+
"image": "image-name",
2727
"use_conda": True,
2828
"source_folder": td,
2929
"oci_config": "~/.oci/config",
@@ -33,24 +33,25 @@ def test_init_vscode_conda(self):
3333
}
3434
}
3535
)
36-
backend.init_vscode_container()
37-
with open(os.path.join(td, ".devcontainer.json")) as f:
38-
content = json.load(f)
39-
assert content == {
40-
"image": "ml-job",
41-
"extensions": ["ms-python.python"],
42-
"mounts": [
43-
f"source={os.path.expanduser('~/.oci')},target=/home/datascience/.oci,type=bind",
44-
f"source={os.path.expanduser('~/conda')},target=/opt/conda/envs,type=bind",
45-
],
46-
"workspaceMount": f"source={td},target=/home/datascience/{os.path.basename(td)},type=bind",
47-
"workspaceFolder": "/home/datascience",
48-
"containerEnv": {},
49-
"name": "ml-job-dev-env",
50-
"postCreateCommand": "conda init bash && source ~/.bashrc",
51-
}
36+
with pytest.raises(ValueError):
37+
with pytest.raises(RuntimeError):
38+
backend.init_vscode_container()
39+
with open(os.path.join(td, ".devcontainer.json")) as f:
40+
content = json.load(f)
41+
assert content == {
42+
"image": "image-name",
43+
"extensions": ["ms-python.python"],
44+
"mounts": [
45+
f"source={os.path.expanduser('~/.oci')},target=/home/datascience/.oci,type=bind",
46+
f"source={os.path.expanduser('~/conda')},target=/opt/conda/envs,type=bind",
47+
],
48+
"workspaceMount": f"source={td},target=/home/datascience/{os.path.basename(td)},type=bind",
49+
"workspaceFolder": "/home/datascience",
50+
"containerEnv": {},
51+
"name": "ml-job-dev-env",
52+
"postCreateCommand": "conda init bash && source ~/.bashrc",
53+
}
5254

53-
@pytest.mark.opctl
5455
def test_init_vscode_image(self):
5556
with tempfile.TemporaryDirectory() as td:
5657
backend = LocalBackend(
@@ -66,9 +67,6 @@ def test_init_vscode_image(self):
6667
)
6768
with pytest.raises(RuntimeError):
6869
backend.init_vscode_container()
69-
with patch("ads.opctl.utils.docker") as d:
70-
d.DockerClient.api.inspect_image.return_value = True
71-
backend.init_vscode_container()
7270
with open(".devcontainer.json") as f:
7371
content = json.load(f)
7472
assert content == {

0 commit comments

Comments
 (0)