Skip to content

Commit 7ec93f6

Browse files
authored
Merge pull request #3593 from AlexsLemonade/davidsmejia/3574-un-nvidia-compendia
Move compendia off of nvidia cuda image and onto base
2 parents 2f37714 + f88b4af commit 7ec93f6

7 files changed

Lines changed: 28 additions & 226 deletions

File tree

docker-bake.hcl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ variable "PUSH_CACHE" {
4444
default = false
4545
}
4646

47-
// Default amd64 because some upstream bases (nvidia/cuda for compendia) and
48-
// apt packages have no arm64 variant.
47+
// Default amd64 because the Salmon / SRA Toolkit binaries (Dockerfile.salmon,
48+
// Dockerfile.transcriptome) are x86_64-only and some apt packages have no
49+
// arm64 variant.
4950
variable "PLATFORMS" {
5051
// description = "Comma-separated platforms to build for."
5152
default = "linux/amd64"
@@ -240,10 +241,10 @@ target "downloaders" {
240241
cache-to = cache_to_for("downloaders")
241242
}
242243

243-
// Compendia uses nvidia/cuda directly, not the shared base.
244244
target "compendia" {
245245
inherits = ["_common"]
246246
dockerfile = "workers/dockerfiles/Dockerfile.compendia"
247+
contexts = from_target("base")
247248
tags = tags_for("compendia")
248249
cache-from = cache_from_for("compendia")
249250
cache-to = cache_to_for("compendia")

workers/data_refinery_workers/processors/create_compendia.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -278,10 +278,6 @@ def _filter_rows_and_columns(job_context: Dict) -> Dict:
278278

279279
drop_na_genes_start = log_state("start drop NA genes", job_context["job"].id)
280280

281-
# # Visualize Prefiltered
282-
# output_path = job_context['output_dir'] + "pre_filtered_" + str(time.time()) + ".png"
283-
# visualized_prefilter = visualize.visualize(combined_matrix.copy(), output_path)
284-
285281
combined_matrix = job_context.pop("combined_matrix")
286282

287283
# Remove genes (rows) with <=70% present values in combined_matrix
@@ -297,10 +293,6 @@ def _filter_rows_and_columns(job_context: Dict) -> Dict:
297293
log_state("end drop NA genes", job_context["job"].id, drop_na_genes_start)
298294
drop_na_samples_start = log_state("start drop NA samples", job_context["job"].id)
299295

300-
# # Visualize Row Filtered
301-
# output_path = job_context['output_dir'] + "row_filtered_" + str(time.time()) + ".png"
302-
# visualized_rowfilter = visualize.visualize(row_filtered_matrix.copy(), output_path)
303-
304296
# Remove samples (columns) with <50% present values in combined_matrix
305297
# XXX: Find better test data for this!
306298
col_thresh = row_filtered_matrix.shape[0] * 0.5
@@ -342,11 +334,6 @@ def _reset_zero_values(job_context: Dict) -> Dict:
342334
row_col_filtered_matrix_index = job_context.get("row_col_filtered_matrix_index")
343335
cached_zeroes = job_context.pop("cached_zeroes")
344336

345-
# # Visualize Row and Column Filtered
346-
# output_path = job_context['output_dir'] + "row_col_filtered_" + str(time.time()) + ".png"
347-
# visualized_rowcolfilter = visualize.visualize(row_col_filtered_matrix.copy(),
348-
# output_path)
349-
350337
# "Reset" zero values that were set to NA in RNA-seq samples
351338
# (i.e., make these zero again) in combined_matrix
352339
for column in cached_zeroes.keys():
@@ -442,9 +429,6 @@ def _run_iterativesvd(job_context: Dict) -> Dict:
442429
del row_col_filtered_matrix_columns
443430

444431
job_context["merged_no_qn"] = untransposed_imputed_matrix_df
445-
# output_path = job_context['output_dir'] + "compendia_no_qn_" + str(time.time()) + ".png"
446-
# visualized_merged_no_qn = visualize.visualize(untransposed_imputed_matrix_df.copy(),
447-
# output_path)
448432

449433
log_state("end untranspose", job_context["job"].id, untranspose_start)
450434

@@ -511,10 +495,6 @@ def _quantile_normalize(job_context: Dict) -> Dict:
511495

512496
log_state("end quantile normalize", job_context["job"].id, quantile_start)
513497

514-
# Visualize Final Compendia
515-
# output_path = job_context['output_dir'] + "compendia_with_qn_" + str(time.time()) + ".png"
516-
# visualized_merged_qn = visualize.visualize(job_context['merged_qn'].copy(), output_path)
517-
518498
return job_context
519499

520500

workers/data_refinery_workers/processors/requirements.in

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,6 @@ simplejson
1818
sympy
1919
unicodecsv
2020
untangle>=1.1.1
21-
# For visualization
22-
dask>=1.1.1
23-
xarray==0.16.2
24-
datashader==0.14.4
25-
datashape>=0.5.2
26-
holoviews>=1.11.2
27-
selenium==3.141.0
2821
# For mocking out S3 calls for the smasher.
2922
vcrpy==4.1.1
3023
django-computedfields>=0.1.5
Lines changed: 13 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,93 +1,61 @@
11
#
2-
# This file is autogenerated by pip-compile with Python 3.8
2+
# This file is autogenerated by pip-compile with Python 3.10
33
# by the following command:
44
#
55
# pip-compile --annotation-style=line requirements.in
66
#
77
asgiref==3.6.0 # via django
8-
bleach==6.0.0 # via panel
9-
bokeh==2.4.3 # via panel
108
boto3==1.26.72 # via -r requirements.in
119
botocore==1.29.72 # via boto3, s3transfer
1210
certifi==2023.7.22 # via -r requirements.in, requests
1311
cffi==1.15.1 # via rpy2
1412
charset-normalizer==3.0.1 # via requests
15-
click==8.1.3 # via dask
16-
cloudpickle==2.2.1 # via dask
17-
colorcet==3.0.1 # via datashader, holoviews
1813
contourpy==1.0.7 # via matplotlib
1914
cycler==0.11.0 # via matplotlib
20-
dask==2023.2.0 # via -r requirements.in, datashader
21-
datashader==0.14.4 # via -r requirements.in
22-
datashape==0.5.2 # via -r requirements.in, datashader
2315
defusedxml==0.7.1 # via untangle
2416
django==3.2.18 # via -r requirements.in, django-computedfields, django-fast-update
2517
django-computedfields==0.2.1 # via -r requirements.in
2618
django-fast-update==0.2.1 # via django-computedfields
2719
fonttools==4.38.0 # via matplotlib
28-
fsspec==2023.1.0 # via dask
29-
holoviews==1.15.4 # via -r requirements.in
3020
idna==3.4 # via requests, yarl
31-
importlib-metadata==6.0.0 # via markdown, numba
32-
importlib-resources==5.10.2 # via matplotlib
33-
jinja2==3.1.2 # via -r requirements.in, bokeh, rpy2
21+
jinja2==3.1.2 # via -r requirements.in, rpy2
3422
jmespath==1.0.1 # via boto3, botocore
3523
joblib==1.2.0 # via scikit-learn
3624
kiwisolver==1.4.4 # via matplotlib
37-
llvmlite==0.39.1 # via numba
38-
locket==1.0.0 # via partd
39-
markdown==3.4.1 # via panel
4025
markupsafe==2.1.2 # via jinja2
4126
matplotlib==3.7.0 # via -r requirements.in
4227
mpmath==1.2.1 # via sympy
4328
multidict==6.0.4 # via yarl
44-
multipledispatch==0.6.0 # via datashape
4529
nose==1.3.7 # via -r requirements.in
46-
numba==0.56.4 # via datashader
47-
numpy==1.23.5 # via -r requirements.in, bokeh, contourpy, datashader, datashape, holoviews, matplotlib, numba, pandas, scikit-learn, scipy, xarray
48-
packaging==23.0 # via bokeh, dask, holoviews, matplotlib
49-
pandas==1.5.3 # via -r requirements.in, datashader, holoviews, xarray
50-
panel==0.14.3 # via holoviews
51-
param==1.12.3 # via datashader, holoviews, panel, pyct, pyviz-comms
52-
partd==1.3.0 # via dask
53-
pillow==9.4.0 # via -r requirements.in, bokeh, datashader, matplotlib
30+
numpy==1.23.5 # via -r requirements.in, contourpy, matplotlib, pandas, scikit-learn, scipy
31+
packaging==23.0 # via matplotlib
32+
pandas==1.5.3 # via -r requirements.in
33+
pillow==9.4.0 # via -r requirements.in, matplotlib
5434
psutil==5.9.4 # via -r requirements.in
5535
psycopg2-binary==2.9.5 # via -r requirements.in
5636
pycparser==2.21 # via cffi
57-
pyct==0.5.0 # via colorcet, datashader, panel
5837
pyparsing==3.0.9 # via matplotlib
59-
python-dateutil==2.8.2 # via botocore, datashape, matplotlib, pandas
38+
python-dateutil==2.8.2 # via botocore, matplotlib, pandas
6039
pytz==2022.7.1 # via django, pandas, rpy2
6140
pytz-deprecation-shim==0.1.0.post0 # via tzlocal
62-
pyviz-comms==2.2.1 # via holoviews, panel
63-
pyyaml==6.0 # via -r requirements.in, bokeh, dask, vcrpy
64-
requests==2.28.2 # via -r requirements.in, datashader, panel
41+
pyyaml==6.0 # via -r requirements.in, vcrpy
42+
requests==2.28.2 # via -r requirements.in
6543
retrying==1.3.4 # via -r requirements.in
6644
rpy2===3.4.5 # via -r requirements.in
6745
s3transfer==0.6.0 # via boto3
6846
scikit-learn==1.2.1 # via -r requirements.in
69-
scipy==1.10.0 # via -r requirements.in, datashader, scikit-learn
70-
selenium==3.141.0 # via -r requirements.in
47+
scipy==1.10.0 # via -r requirements.in, scikit-learn
7148
simplejson==3.18.3 # via -r requirements.in
72-
six==1.16.0 # via bleach, multipledispatch, python-dateutil, retrying, vcrpy
49+
six==1.16.0 # via python-dateutil, retrying, vcrpy
7350
sqlparse==0.4.3 # via -r requirements.in, django
7451
sympy==1.11.1 # via -r requirements.in
7552
threadpoolctl==3.1.0 # via scikit-learn
76-
toolz==0.12.0 # via dask, datashader, partd
77-
tornado==6.2 # via bokeh
78-
tqdm==4.64.1 # via panel
79-
typing-extensions==4.5.0 # via bokeh, django-computedfields, panel
53+
typing-extensions==4.5.0 # via django-computedfields
8054
tzdata==2022.7 # via pytz-deprecation-shim
8155
tzlocal==4.2 # via -r requirements.in, rpy2
8256
unicodecsv==0.14.1 # via -r requirements.in
8357
untangle==1.2.1 # via -r requirements.in
84-
urllib3==1.26.14 # via botocore, requests, selenium
58+
urllib3==1.26.14 # via botocore, requests
8559
vcrpy==4.1.1 # via -r requirements.in
86-
webencodings==0.5.1 # via bleach
8760
wrapt==1.14.1 # via vcrpy
88-
xarray==0.16.2 # via -r requirements.in, datashader
8961
yarl==1.8.2 # via vcrpy
90-
zipp==3.13.0 # via importlib-metadata, importlib-resources
91-
92-
# The following packages are considered to be unsafe in a requirements file:
93-
# setuptools

workers/data_refinery_workers/processors/visualize.py

Lines changed: 0 additions & 57 deletions
This file was deleted.

workers/data_refinery_workers/requirements/compendia.txt

Lines changed: 0 additions & 9 deletions
This file was deleted.

workers/dockerfiles/Dockerfile.compendia

Lines changed: 11 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,112 +1,38 @@
1-
# This is very similar to the `smasher` image, but comes with OpenBLAS and some
2-
# of the other libraries required for fancyimpute.
1+
# This is very similar to the `smasher` image, but additionally installs
2+
# fancySVD, which provides the IterativeSVD imputation create_compendia uses.
33

4-
FROM nvidia/cuda:11.8.0-runtime-ubuntu18.04
4+
ARG DOCKERHUB_REPO
5+
ARG SYSTEM_VERSION
6+
FROM $DOCKERHUB_REPO/dr_base:$SYSTEM_VERSION
7+
ARG SYSTEM_VERSION
58

69
# Fail in case of an error at any stage in the pipe.
710
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
811

9-
# Add MIT as a fallback mirror alongside archive.ubuntu.com.
10-
RUN grep '^deb ' /etc/apt/sources.list \
11-
| sed -e 's|http://archive.ubuntu.com/ubuntu|http://mirrors.mit.edu/ubuntu|g' \
12-
-e 's|http://security.ubuntu.com/ubuntu|http://mirrors.mit.edu/ubuntu|g' \
13-
>> /etc/apt/sources.list
14-
15-
# Prevent tzdata from prompting us for a timezone and hanging the build.
16-
ENV DEBIAN_FRONTEND=noninteractive
17-
18-
# Source: https://github.com/thisbejim/Pyrebase/issues/87#issuecomment-354452082
19-
# For whatever reason this worked and 'en_US.UTF-8' did not.
20-
ENV LANG=C.UTF-8
21-
22-
# RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
23-
# via https://github.com/ilikenwf/apt-fast/issues/85#issuecomment-261640099
24-
RUN <<EOF
25-
echo debconf apt-fast/maxdownloads string 16 | debconf-set-selections
26-
echo debconf apt-fast/dlflag boolean true | debconf-set-selections
27-
echo debconf apt-fast/aptmanager string apt-get | debconf-set-selections
28-
echo 'tzdata tzdata/Areas select Etc' | debconf-set-selections
29-
echo 'tzdata tzdata/Zones/Etc select UTC' | debconf-set-selections
30-
apt-get update -qq
31-
apt-get install --no-install-recommends -y software-properties-common
32-
add-apt-repository ppa:apt-fast/stable
33-
add-apt-repository ppa:deadsnakes/ppa
34-
add-apt-repository ppa:savoury1/llvm-defaults-10
35-
apt-get update -qq
36-
apt-get install --no-install-recommends -y apt-fast apt-transport-https gpg-agent tzdata
37-
apt-fast update -qq
38-
apt-fast install -y \
39-
build-essential \
40-
cmake \
41-
curl \
42-
cython3 \
43-
ed \
44-
gfortran \
45-
git \
46-
libblas-dev \
47-
libcairo-dev \
48-
libcurl4-openssl-dev \
49-
libedit-dev \
50-
liblapack-dev \
51-
libpq-dev \
52-
libssl-dev \
53-
libxml2-dev \
54-
llvm-10-dev \
55-
lsb-release \
56-
mercurial \
57-
pkg-config \
58-
python3-pip \
59-
python3-pybind11 \
60-
python3.8 \
61-
python3.8-dev \
62-
r-base-core \
63-
wget
64-
apt-get clean
65-
rm -rf /var/lib/apt/lists/*
66-
ln -s /usr/bin/llvm-config-10 /usr/bin/llvm-config
67-
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
68-
pip3 install --upgrade pip setuptools
69-
groupadd user
70-
useradd --create-home --home-dir /home/user -g user user
71-
EOF
72-
7312
WORKDIR /home/user
7413

75-
ENV R_LIBS=/usr/local/lib/R/site-library
76-
7714
COPY workers/R/dependencies/compendia/renv.lock .
7815
COPY common/R/renv_load.R renv_load_compendia.R
7916
RUN Rscript renv_load_compendia.R
8017

81-
COPY workers/data_refinery_workers/requirements/compendia.txt requirements.txt
82-
# Pin setuptools<70 (otherwise it tries to import wheel internals that
83-
# newer wheel releases moved) so fancySVD builds cleanly from sdist.
84-
RUN pip3 install --upgrade 'setuptools<70' 'wheel<0.42'
85-
RUN pip3 install --ignore-installed --no-cache-dir -r requirements.txt
86-
8718
COPY workers/data_refinery_workers/processors/requirements.txt requirements.txt
8819
RUN pip3 install --ignore-installed --no-cache-dir -r requirements.txt
8920

90-
# Install phantomjs.
91-
RUN <<EOF
92-
wget -q https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
93-
tar xvjf phantomjs-2.1.1-linux-x86_64.tar.bz2 -C /usr/local/share/
94-
ln -s /usr/local/share/phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin/
95-
rm phantomjs-2.1.1-linux-x86_64.tar.bz2
96-
EOF
21+
# fancySVD provides the IterativeSVD imputation create_compendia imports. It is
22+
# compendia-only and pure-Python, but its setup.py pins scikit-learn==0.24.2 and
23+
# an old numpy that have no Python 3.10 wheels (they'd build from sdist). Install
24+
# it without deps; the scikit-learn and numpy pinned above satisfy it at runtime.
25+
RUN pip3 install --no-deps --no-cache-dir fancySVD==0.1.3
9726

9827
# Get the latest version from the dist directory.
9928
COPY common/dist/data?refinery?common-* common/
10029
RUN pip3 install --ignore-installed --no-cache-dir common/$(ls common -1 | sort --version-sort | tail -1)
10130

10231
COPY .boto .boto
103-
COPY config/ config/
104-
COPY setup.cfg .
10532
COPY workers/ .
10633

10734
RUN rm -rf /root/.cache/*
10835

109-
ARG SYSTEM_VERSION
11036
ENV SYSTEM_VERSION=$SYSTEM_VERSION
11137

11238
USER user

0 commit comments

Comments
 (0)