Skip to content
This repository was archived by the owner on Oct 16, 2025. It is now read-only.

Commit 0309e5d

Browse files
authored
feat: ASP-3288 Add a custom Python 3.8 installation (#181)
1 parent 87dd887 commit 0309e5d

File tree

13 files changed

+156
-142
lines changed

13 files changed

+156
-142
lines changed

CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ This file keeps track of all notable changes to the Slurm Charms.
77
Unreleased
88
----------
99

10+
- added a custom python installation to run the charm code
11+
- removed CentOS 8 support
12+
1013
1.1.2 - 2023-09-07
1114
------------------
1215

charm-slurmctld/charmcraft.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ bases:
1313
- name: centos
1414
channel: "7"
1515
architectures: [amd64]
16-
- name: centos
17-
channel: "8"
18-
architectures: [amd64]
1916
parts:
2017
charm:
2118
build-packages: [git]

charm-slurmctld/dispatch

Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,55 @@
11
#!/bin/bash
2-
# This hook installs the centos dependencies needed to run the charm,
2+
# This hook installs the dependencies needed to run the charm,
33
# creates the dispatch executable, regenerates the symlinks for start and
44
# upgrade-charm, and kicks off the operator framework.
55

66
set -e
77

8-
# Source the os-release information into the env.
8+
# Source the os-release information into the env
99
. /etc/os-release
1010

1111
if ! [[ -f '.installed' ]]
1212
then
13-
# Determine if we are running in centos or ubuntu, if centos
14-
# provision the needed prereqs.
15-
if [[ $ID == 'ubuntu' ]]
16-
then
17-
echo "Running Ubuntu."
18-
echo "Nothing to do."
19-
elif [[ $ID == 'centos' ]]
20-
then
21-
# Determine the centos version and install prereqs accordingly
22-
major=$(cat /etc/centos-release | tr -dc '0-9.'|cut -d \. -f1)
23-
echo "Running CentOS$major, installing prereqs."
24-
if [[ $major == "7" ]]
25-
then
26-
yum -y install epel-release
27-
yum -y install yum-priorities python3
28-
elif [[ $major == "8" ]]
29-
then
30-
dnf -y install epel-release
31-
dnf -y install yum-priorities python3
32-
else
33-
echo "Running unsuppored version of centos: $major"
34-
exit -1
35-
fi
36-
elif [[ $ID == 'rocky' ]]
13+
14+
# Rocky specific setup
15+
if [[ $ID == 'rocky' ]]
3716
then
3817
dnf install epel-release -y
3918
dnf install dnf-plugins-core -y
4019
dnf config-manager --set-enabled powertools -y
41-
dnf install make automake yum-utils -y
42-
else
43-
echo "Running unsuppored os: $ID"
44-
exit -1
45-
fi
20+
fi
21+
22+
if [[ $ID == 'centos' || $ID == 'rocky' ]]
23+
then
24+
# Install dependencies
25+
yum -y install epel-release
26+
yum -y install yum-priorities python3 automake yum-utils
27+
28+
# Install dependencies and build custom python
29+
yum -y install wget gcc make tar bzip2-devel zlib-devel xz-devel openssl-devel libffi-devel sqlite-devel ncurses-devel
30+
31+
export PYTHON_VERSION=3.8.16
32+
wget https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tar.xz -P /tmp
33+
tar xvf /tmp/Python-${PYTHON_VERSION}.tar.xz -C /tmp
34+
cd /tmp/Python-${PYTHON_VERSION}
35+
./configure --prefix=/opt/python/python3.8 --enable-optimizations
36+
make -C /tmp/Python-${PYTHON_VERSION} -j $(nproc) altinstall
37+
cd $OLDPWD
38+
rm -rf /tmp/Python*
39+
40+
# set the correct python bin path
41+
PYTHON_BIN="/opt/python/python3.8/bin/python3.8"
42+
elif [[ $ID == 'ubuntu' ]]
43+
then
44+
# Necessary to compile and install NHC
45+
apt-get install --assume-yes make
46+
47+
# set the correct python bin path
48+
PYTHON_BIN="/usr/bin/env python3"
49+
fi
50+
4651
touch .installed
4752
fi
4853

49-
JUJU_DISPATCH_PATH="${JUJU_DISPATCH_PATH:-$0}" PYTHONPATH=lib:venv ./src/charm.py
54+
55+
JUJU_DISPATCH_PATH="${JUJU_DISPATCH_PATH:-$0}" PYTHONPATH=lib:venv $PYTHON_BIN ./src/charm.py

charm-slurmctld/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ influxdb==5.3.1
33
urllib3==1.26.9
44
etcd3gw==1.0.2
55
jinja2==3.1.2
6-
git+https://github.com/omnivector-solutions/slurm-ops-manager.git@0.8.15
6+
git+https://github.com/omnivector-solutions/slurm-ops-manager.git@0.8.16

charm-slurmd/charmcraft.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ bases:
1313
- name: centos
1414
channel: "7"
1515
architectures: [amd64]
16-
- name: centos
17-
channel: "8"
18-
architectures: [amd64]
1916
parts:
2017
charm:
2118
build-packages: [git]

charm-slurmd/dispatch

Lines changed: 37 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,55 @@
11
#!/bin/bash
2-
# This hook installs the centos dependencies needed to run the charm,
2+
# This hook installs the dependencies needed to run the charm,
33
# creates the dispatch executable, regenerates the symlinks for start and
44
# upgrade-charm, and kicks off the operator framework.
55

66
set -e
77

8-
# Source the os-release information into the env.
8+
# Source the os-release information into the env
99
. /etc/os-release
1010

1111
if ! [[ -f '.installed' ]]
1212
then
13-
# Determine if we are running in centos or ubuntu, if centos
14-
# provision the needed prereqs.
15-
if [[ $ID == 'ubuntu' ]]
16-
then
17-
echo "Running Ubuntu."
18-
# necessary to compile and install NHC
19-
apt-get install --assume-yes make automake
20-
elif [[ $ID == 'centos' ]]
21-
then
22-
# Determine the centos version and install prereqs accordingly
23-
major=$(cat /etc/centos-release | tr -dc '0-9.'|cut -d \. -f1)
24-
echo "Running CentOS$major, installing prereqs."
25-
if [[ $major == "7" ]]
26-
then
27-
yum -y install epel-release
28-
yum -y install yum-priorities python3 make automake yum-utils
29-
elif [[ $major == "8" ]]
30-
then
31-
dnf -y install epel-release
32-
dnf -y install yum-priorities python3 make automake yum-utils
33-
else
34-
echo "Running unsuppored version of centos: $major"
35-
exit -1
36-
fi
37-
elif [[ $ID == 'rocky' ]]
13+
14+
# Rocky specific setup
15+
if [[ $ID == 'rocky' ]]
3816
then
3917
dnf install epel-release -y
4018
dnf install dnf-plugins-core -y
4119
dnf config-manager --set-enabled powertools -y
42-
dnf install make automake yum-utils -y
43-
else
44-
echo "Running unsuppored os: $ID"
45-
exit -1
4620
fi
21+
22+
if [[ $ID == 'centos' || $ID == 'rocky' ]]
23+
then
24+
# Install dependencies
25+
yum -y install epel-release
26+
yum -y install yum-priorities python3 automake yum-utils
27+
28+
# Install dependencies and build custom python
29+
yum -y install wget gcc make tar bzip2-devel zlib-devel xz-devel openssl-devel libffi-devel sqlite-devel ncurses-devel
30+
31+
export PYTHON_VERSION=3.8.16
32+
wget https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tar.xz -P /tmp
33+
tar xvf /tmp/Python-${PYTHON_VERSION}.tar.xz -C /tmp
34+
cd /tmp/Python-${PYTHON_VERSION}
35+
./configure --prefix=/opt/python/python3.8 --enable-optimizations
36+
make -C /tmp/Python-${PYTHON_VERSION} -j $(nproc) altinstall
37+
cd $OLDPWD
38+
rm -rf /tmp/Python*
39+
40+
# set the correct python bin path
41+
PYTHON_BIN="/opt/python/python3.8/bin/python3.8"
42+
elif [[ $ID == 'ubuntu' ]]
43+
then
44+
# Necessary to compile and install NHC
45+
apt-get install --assume-yes make
46+
47+
# set the correct python bin path
48+
PYTHON_BIN="/usr/bin/env python3"
49+
fi
50+
4751
touch .installed
4852
fi
4953

50-
JUJU_DISPATCH_PATH="${JUJU_DISPATCH_PATH:-$0}" PYTHONPATH=lib:venv ./src/charm.py
54+
55+
JUJU_DISPATCH_PATH="${JUJU_DISPATCH_PATH:-$0}" PYTHONPATH=lib:venv $PYTHON_BIN ./src/charm.py

charm-slurmd/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
ops==1.3.0
22
urllib3==1.26.9
33
etcd3gw==1.0.2
4-
git+https://github.com/omnivector-solutions/slurm-ops-manager.git@0.8.15
4+
git+https://github.com/omnivector-solutions/slurm-ops-manager.git@0.8.16

charm-slurmdbd/charmcraft.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ bases:
1313
- name: centos
1414
channel: "7"
1515
architectures: [amd64]
16-
- name: centos
17-
channel: "8"
18-
architectures: [amd64]
1916
parts:
2017
charm:
2118
build-packages: [git]

charm-slurmdbd/dispatch

Lines changed: 37 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,55 @@
11
#!/bin/bash
2-
# This hook installs the centos dependencies needed to run the charm,
2+
# This hook installs the dependencies needed to run the charm,
33
# creates the dispatch executable, regenerates the symlinks for start and
44
# upgrade-charm, and kicks off the operator framework.
55

66
set -e
77

8-
# Source the os-release information into the env.
8+
# Source the os-release information into the env
99
. /etc/os-release
1010

1111
if ! [[ -f '.installed' ]]
1212
then
13-
# Determine if we are running in centos or ubuntu, if centos
14-
# provision the needed prereqs.
15-
if [[ $ID == 'ubuntu' ]]
16-
then
17-
echo "Running Ubuntu."
18-
echo "Nothing to do."
19-
elif [[ $ID == 'centos' ]]
20-
then
21-
# Determine the centos version and install prereqs accordingly
22-
major=$(cat /etc/centos-release | tr -dc '0-9.'|cut -d \. -f1)
23-
echo "Running CentOS$major, installing prereqs."
24-
if [[ $major == "7" ]]
25-
then
26-
yum -y install epel-release
27-
yum -y install yum-priorities python3
28-
elif [[ $major == "8" ]]
29-
then
30-
dnf -y install epel-release
31-
dnf -y install yum-priorities python3
32-
else
33-
echo "Running unsuppored version of centos: $major"
34-
exit -1
35-
fi
36-
elif [[ $ID == 'rocky' ]]
13+
14+
# Rocky specific setup
15+
if [[ $ID == 'rocky' ]]
3716
then
3817
dnf install epel-release -y
3918
dnf install dnf-plugins-core -y
4019
dnf config-manager --set-enabled powertools -y
41-
dnf install make automake yum-utils -y
42-
else
43-
echo "Running unsuppored os: $ID"
44-
exit -1
4520
fi
21+
22+
if [[ $ID == 'centos' || $ID == 'rocky' ]]
23+
then
24+
# Install dependencies
25+
yum -y install epel-release
26+
yum -y install yum-priorities python3 automake yum-utils
27+
28+
# Install dependencies and build custom python
29+
yum -y install wget gcc make tar bzip2-devel zlib-devel xz-devel openssl-devel libffi-devel sqlite-devel ncurses-devel
30+
31+
export PYTHON_VERSION=3.8.16
32+
wget https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tar.xz -P /tmp
33+
tar xvf /tmp/Python-${PYTHON_VERSION}.tar.xz -C /tmp
34+
cd /tmp/Python-${PYTHON_VERSION}
35+
./configure --prefix=/opt/python/python3.8 --enable-optimizations
36+
make -C /tmp/Python-${PYTHON_VERSION} -j $(nproc) altinstall
37+
cd $OLDPWD
38+
rm -rf /tmp/Python*
39+
40+
# set the correct python bin path
41+
PYTHON_BIN="/opt/python/python3.8/bin/python3.8"
42+
elif [[ $ID == 'ubuntu' ]]
43+
then
44+
# Necessary to compile and install NHC
45+
apt-get install --assume-yes make
46+
47+
# set the correct python bin path
48+
PYTHON_BIN="/usr/bin/env python3"
49+
fi
50+
4651
touch .installed
4752
fi
4853

49-
JUJU_DISPATCH_PATH="${JUJU_DISPATCH_PATH:-$0}" PYTHONPATH=lib:venv ./src/charm.py
54+
55+
JUJU_DISPATCH_PATH="${JUJU_DISPATCH_PATH:-$0}" PYTHONPATH=lib:venv $PYTHON_BIN ./src/charm.py

charm-slurmdbd/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
ops==1.3.0
2-
git+https://github.com/omnivector-solutions/slurm-ops-manager.git@0.8.15
2+
git+https://github.com/omnivector-solutions/slurm-ops-manager.git@0.8.16

0 commit comments

Comments
 (0)