Skip to content

Commit a89b48e

Browse files
authored
Merge pull request #3945 from scimerman/develop
switch to using pip3 for installing EasyBuild in Singularity definition file generated by EasyBuild
2 parents 9599e98 + c20e0b5 commit a89b48e

File tree

4 files changed

+41
-31
lines changed

4 files changed

+41
-31
lines changed

easybuild/tools/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@
134134
JOB_DEPS_TYPE_ABORT_ON_ERROR = 'abort_on_error'
135135
JOB_DEPS_TYPE_ALWAYS_RUN = 'always_run'
136136

137-
DOCKER_BASE_IMAGE_UBUNTU = 'ubuntu:16.04'
137+
DOCKER_BASE_IMAGE_UBUNTU = 'ubuntu:20.04'
138138
DOCKER_BASE_IMAGE_CENTOS = 'centos:7'
139139

140140
LOCAL_VAR_NAMING_CHECK_ERROR = 'error'

easybuild/tools/containers/docker.py

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
from easybuild.tools.containers.base import ContainerGenerator
3636
from easybuild.tools.containers.utils import det_os_deps
3737
from easybuild.tools.filetools import remove_dir
38+
from easybuild.tools.module_naming_scheme.easybuild_mns import EasyBuildMNS
3839
from easybuild.tools.run import run_cmd
3940

4041

@@ -44,9 +45,9 @@
4445
"""
4546

4647
DOCKER_INSTALL_EASYBUILD = """\
47-
RUN pip install -U pip setuptools && \\
48-
hash -r pip && \\
49-
pip install -U easybuild
48+
RUN pip3 install -U pip setuptools && \\
49+
hash -r pip3&& \\
50+
pip3 install -U easybuild
5051
5152
RUN mkdir /app && \\
5253
mkdir /scratch && \\
@@ -61,37 +62,43 @@
6162
6263
RUN set -x && \\
6364
. /usr/share/lmod/lmod/init/sh && \\
64-
eb %(eb_opts)s --installpath=/app/ --prefix=/scratch --tmpdir=/scratch/tmp
65+
eb --robot %(eb_opts)s --installpath=/app/ --prefix=/scratch --tmpdir=/scratch/tmp
6566
66-
RUN touch ${HOME}/.profile && \\
67-
echo '\\n# Added by easybuild docker packaging' >> ${HOME}/.profile && \\
68-
echo 'source /usr/share/lmod/lmod/init/bash' >> ${HOME}/.profile && \\
69-
echo 'module use %(init_modulepath)s' >> ${HOME}/.profile && \\
70-
echo 'module load %(mod_names)s' >> ${HOME}/.profile
67+
RUN touch ${HOME}/.bashrc && \\
68+
echo '' >> ${HOME}/.bashrc && \\
69+
echo '# Added by easybuild docker packaging' >> ${HOME}/.bashrc && \\
70+
echo 'source /usr/share/lmod/lmod/init/bash' >> ${HOME}/.bashrc && \\
71+
echo 'module use %(init_modulepath)s' >> ${HOME}/.bashrc && \\
72+
echo 'module load %(mod_names)s' >> ${HOME}/.bashrc
7173
7274
CMD ["/bin/bash", "-l"]
7375
"""
7476

75-
DOCKER_UBUNTU1604_INSTALL_DEPS = """\
77+
DOCKER_UBUNTU2004_INSTALL_DEPS = """\
7678
RUN apt-get update && \\
77-
apt-get install -y python python-pip lmod curl wget
79+
DEBIAN_FRONTEND=noninteractive apt-get install -y python3 python3-pip lmod \\
80+
curl wget git bzip2 gzip tar zip unzip xz-utils \\
81+
patch automake git debianutils \\
82+
g++ libdata-dump-perl libthread-queue-any-perl libssl-dev
7883
7984
RUN OS_DEPS='%(os_deps)s' && \\
80-
test -n "${OS_DEPS}" && \\
8185
for dep in ${OS_DEPS}; do apt-get -qq install ${dep} || true; done
8286
"""
8387

8488
DOCKER_CENTOS7_INSTALL_DEPS = """\
8589
RUN yum install -y epel-release && \\
86-
yum install -y python python-pip Lmod curl wget git
90+
yum install -y python3 python3-pip Lmod curl wget git \\
91+
bzip2 gzip tar zip unzip xz \\
92+
patch make git which \\
93+
gcc-c++ perl-Data-Dumper perl-Thread-Queue openssl-dev
8794
8895
RUN OS_DEPS='%(os_deps)s' && \\
8996
test -n "${OS_DEPS}" && \\
9097
yum --skip-broken install -y "${OS_DEPS}" || true
9198
"""
9299

93100
DOCKER_OS_INSTALL_DEPS_TMPLS = {
94-
DOCKER_BASE_IMAGE_UBUNTU: DOCKER_UBUNTU1604_INSTALL_DEPS,
101+
DOCKER_BASE_IMAGE_UBUNTU: DOCKER_UBUNTU2004_INSTALL_DEPS,
95102
DOCKER_BASE_IMAGE_CENTOS: DOCKER_CENTOS7_INSTALL_DEPS,
96103
}
97104

@@ -125,9 +132,12 @@ def resolve_template_data(self):
125132

126133
ec = self.easyconfigs[-1]['ec']
127134

128-
init_modulepath = os.path.join("/app/modules/all", *self.mns.det_init_modulepaths(ec))
135+
# We are using the default MNS inside the container
136+
docker_mns = EasyBuildMNS()
137+
138+
init_modulepath = os.path.join("/app/modules/all", *docker_mns.det_init_modulepaths(ec))
129139

130-
mod_names = [e['ec'].full_mod_name for e in self.easyconfigs]
140+
mod_names = [docker_mns.det_full_module_name(e['ec']) for e in self.easyconfigs]
131141

132142
eb_opts = [os.path.basename(e['spec']) for e in self.easyconfigs]
133143

easybuild/tools/containers/singularity.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,9 @@ def resolve_template_data(self):
272272
# EPEL is required for installing Lmod & python-pip
273273
'epel-release',
274274
# EasyBuild requirements
275-
'python setuptools Lmod',
276-
# pip is used to install EasyBuild packages
277-
'python-pip',
275+
'python3 setuptools Lmod',
276+
# pip3 is used to install EasyBuild packages
277+
'python3-pip',
278278
# useful utilities
279279
'bzip2 gzip tar zip unzip xz', # extracting sources
280280
'curl wget', # downloading
@@ -308,13 +308,13 @@ def resolve_template_data(self):
308308
template_data['install_os_deps'] = '\n'.join(install_os_deps)
309309

310310
# install (latest) EasyBuild in container image
311-
# use 'pip install', unless custom commands are specified via 'install_eb' keyword
311+
# use 'pip3 install', unless custom commands are specified via 'install_eb' keyword
312312
if 'install_eb' not in template_data:
313313
template_data['install_eb'] = '\n'.join([
314-
"# install EasyBuild using pip",
314+
"# install EasyBuild using pip3",
315315
# upgrade pip
316-
"pip install -U pip",
317-
"pip install easybuild",
316+
"pip3 install -U pip",
317+
"pip3 install easybuild",
318318
])
319319

320320
# if no custom value is specified for 'post_commands' keyword,

test/framework/containers.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ def test_end2end_singularity_recipe_config(self):
141141
self.assertTrue(regex.search(txt), "Pattern '%s' found in: %s" % (regex.pattern, txt))
142142

143143
pip_patterns = [
144-
# EasyBuild is installed with pip by default
145-
"pip install easybuild",
144+
# EasyBuild is installed with pip3 by default
145+
"pip3 install easybuild",
146146
]
147147
post_commands_patterns = [
148148
# easybuild user is added if it doesn't exist yet
@@ -386,7 +386,7 @@ def test_end2end_dockerfile(self):
386386
base_args + ['--container-config=not-supported'],
387387
raise_error=True)
388388

389-
for cont_base in ['ubuntu:16.04', 'centos:7']:
389+
for cont_base in ['ubuntu:20.04', 'centos:7']:
390390
stdout, stderr = self.run_main(base_args + ['--container-config=%s' % cont_base])
391391
self.assertFalse(stderr)
392392
regexs = ["^== Dockerfile definition file created at %s/containers/Dockerfile.toy-0.0" % self.test_prefix]
@@ -406,11 +406,11 @@ def test_end2end_dockerfile(self):
406406
remove_file(os.path.join(self.test_prefix, 'containers', 'Dockerfile.toy-0.0'))
407407

408408
base_args.insert(1, os.path.join(test_ecs, 'g', 'GCC', 'GCC-4.9.2.eb'))
409-
self.run_main(base_args + ['--container-config=ubuntu:16.04'])
409+
self.run_main(base_args + ['--container-config=ubuntu:20.04'])
410410
def_file = read_file(os.path.join(self.test_prefix, 'containers', 'Dockerfile.toy-0.0'))
411411
regexs = [
412-
"FROM ubuntu:16.04",
413-
"eb toy-0.0.eb GCC-4.9.2.eb",
412+
"FROM ubuntu:20.04",
413+
"eb --robot toy-0.0.eb GCC-4.9.2.eb",
414414
"module load toy/0.0 GCC/4.9.2",
415415
]
416416
self.check_regexs(regexs, def_file)
@@ -435,7 +435,7 @@ def test_end2end_docker_image(self):
435435
'-C', # equivalent with --containerize
436436
'--experimental',
437437
'--container-type=docker',
438-
'--container-config=ubuntu:16.04',
438+
'--container-config=ubuntu:20.04',
439439
'--container-build-image',
440440
]
441441

0 commit comments

Comments
 (0)