-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A large omnibus PR that adds support for SLURM. * implement the slurm plugin * CLI * many small improvements to the `uenv start` and `uenv run` commands * add the `uenv image ls` command * testing: * setup scripts that create a test repo * install the bats bash testing framework for integration testing * integration tests for the slurm plugin only * template and helper script for building the slurm plugin RPM
- Loading branch information
Showing
69 changed files
with
3,374 additions
and
233 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
CompileFlags: | ||
Add: [-std=c++17, -Iinclude] | ||
Add: [-std=c++20] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
BSD 3-Clause License | ||
|
||
Copyright (c) 2023-2024, ETH Zürich | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
3. Neither the name of the copyright holder nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
option('slurm_plugin', type: 'boolean', value: true) | ||
option('cli', type: 'boolean', value: true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
%__sourcedir . | ||
%__builddir %{_target_platform} | ||
%__meson_wrap_mode nodownload | ||
|
||
%meson_setup \ | ||
mkdir -p %{__builddir} \ | ||
CFLAGS="${CFLAGS:-%optflags}"; export CFLAGS; \ | ||
CXXFLAGS="${CXXFLAGS:-%optflags}"; export CXXFLAGS; \ | ||
FFLAGS="${FFLAGS:-%optflags}"; export FFLAGS; \ | ||
FCFLAGS="${FCFLAGS:-%optflags}"; export FCFLAGS; \ | ||
meson setup %{__sourcedir} %{__builddir} \\\ | ||
%{?_enable_debug:-Ddebug=true} \\\ | ||
--prefix=%{_prefix} \\\ | ||
--bindir=%{_bindir} \\\ | ||
--sbindir=%{_sbindir} \\\ | ||
--libexecdir=%{_libexecdir} \\\ | ||
--libdir=%{_libdir} \\\ | ||
--localstatedir=%{_var} \\\ | ||
--sharedstatedir=%{_sharedstatedir} \\\ | ||
--includedir=%{_includedir} \\\ | ||
--datadir=%{_datadir} \\\ | ||
--sysconfdir=%{_sysconfdir} \\\ | ||
--mandir=%{_mandir} \\\ | ||
--infodir=%{_infodir} \\\ | ||
--localedir=%{_datadir}/locale \\\ | ||
-Dcli=false \\\ | ||
-Dslurm_plugin=true \\\ | ||
%{nil} | ||
|
||
%meson_build \ | ||
meson compile %_smp_mflags -C %{__builddir} | ||
|
||
%meson_install \ | ||
DESTDIR=%buildroot meson install --no-rebuild --skip-subprojects -C %{__builddir} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
#!/bin/bash | ||
|
||
usage="$(basename "$0") [-h] [-s,--skip-binary] [--slurm-version] dstdir | ||
Helper script to create a source and binary rpm of the project. | ||
Options: | ||
-h,--help show this help text | ||
-s,--skip-bin skip creation of binary package | ||
--slurm-version slurm version to specify in RPM dependency, defaults to 20.11.9 | ||
" | ||
|
||
# Default argument | ||
RPM_SLURM_VERSION=20.11.9 | ||
|
||
# Initialize our own variables | ||
skip_bin=0 | ||
|
||
# A temporary variable to hold the output of `getopt` | ||
TEMP=$(getopt -o s,h --long skip-bin,help,slurm-version: -- "$@") | ||
|
||
# If getopt has reported an error, exit script with an error | ||
if [ $? != 0 ]; then | ||
# echo 'Error parsing options' >&2 | ||
echo "${usage}" >&2 | ||
exit 1 | ||
fi | ||
|
||
eval set -- "$TEMP" | ||
|
||
# Now go through all the options | ||
while true; do | ||
case "$1" in | ||
-s | --skip-bin) | ||
skip_bin=1 | ||
shift | ||
;; | ||
--slurm-version) | ||
shift | ||
RPM_SLURM_VERSION="$1" | ||
shift | ||
;; | ||
-h | --help) | ||
shift | ||
echo "${usage}" | ||
exit 1 | ||
;; | ||
--) | ||
shift | ||
break | ||
;; | ||
*) | ||
echo "Internal error! $1" | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
|
||
# Remaining dstdir is in $1 | ||
dstdir=$(realpath $1) | ||
|
||
# Check if the positional argument was provided | ||
if [ -z "$dstdir" ]; then | ||
echo "${usage}" >&2 | ||
exit 1 | ||
fi | ||
|
||
# Print the parsed arguments | ||
echo "skip_bin=$skip_bin" | ||
echo "dstdir=$dstdir" | ||
echo "RPM_SLURM_VERSION=$RPM_SLURM_VERSION" | ||
|
||
set -euo pipefail | ||
|
||
# absolute path to this script (where the spec file is located) | ||
_scriptdir=$(realpath "$(dirname "${BASH_SOURCE[0]}")") | ||
|
||
# the project root directory | ||
_projectdir=$(realpath "${_scriptdir}/../") | ||
|
||
SLURM_UENV_MOUNT_VERSION=$(sed 's/-.*//' "${_scriptdir}/../VERSION") | ||
|
||
rm -rf "${dstdir}" | ||
mkdir -p "${dstdir}" | ||
|
||
echo SLURM_UENV_MOUNT_VERSION=$SLURM_UENV_MOUNT_VERSION | ||
echo _scriptdir=$_scriptdir | ||
echo _projectdir=$_projectdir | ||
tarball=slurm-uenv-mount-"${SLURM_UENV_MOUNT_VERSION}".tar.gz | ||
|
||
( | ||
cd "${dstdir}" | ||
|
||
mkdir -p BUILD BUILDROOT RPMS SOURCES SPECS SRPMS | ||
|
||
source_prefix="slurm-uenv-mount-${SLURM_UENV_MOUNT_VERSION}" | ||
|
||
( | ||
cd "${_projectdir}" | ||
git archive --format=tar.gz --output="${dstdir}/SOURCES/${tarball}" HEAD | ||
) | ||
|
||
cp "${_scriptdir}/slurm-uenv-mount.spec" SPECS/ | ||
sed -i "s|UENVMNT_VERSION|${SLURM_UENV_MOUNT_VERSION}|g" SPECS/slurm-uenv-mount.spec | ||
sed -i "s|RPM_SLURM_VERSION|${RPM_SLURM_VERSION}|g" SPECS/slurm-uenv-mount.spec | ||
|
||
# create src rpm | ||
rpmbuild -bs --define "_topdir ." SPECS/slurm-uenv-mount.spec | ||
|
||
if [ "${skip_bin}" -eq "0" ]; then | ||
# create binary rpm | ||
rpmbuild --nodeps --define "_topdir $(pwd)" \ | ||
--define "set_build_flags CXXFLAGS=\"-O2 -Wall -Wpedantic\"" \ | ||
--define "_vpath_srcdir ${source_prefix}" \ | ||
--rebuild SRPMS/slurm-uenv-mount-*.src.rpm | ||
fi | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# For building RPMs. | ||
|
||
RPM packaging requires that it performs the `meson setup ...`, `meson compile ...` | ||
and `meson install ...` itself, in a controlled environment. The script provided | ||
here drives that process, after making suitable sacrifices to the RPM packaging gods. | ||
|
||
**WARNING**: the tools here build the RPM based on the state of the source code at `HEAD` | ||
in the git repository. If you have uncommitted changes, they will not be reflected | ||
in the generated RPM. | ||
|
||
**NOTE**: building RPMs is fiddly business - it isn't you, it is `rpmbuild`. Contact | ||
Ben or Simon for help instead of trying to find good docs on RPMs (they don't exist). | ||
|
||
## make-rpm.sh | ||
|
||
A script that will generate both source and binary RPMs for the project. | ||
|
||
It requires a destination path where the RPM build will occur, and should be run in this path. | ||
|
||
``` | ||
./rpm-build.sh $HOME/rpm/uenv | ||
``` | ||
|
||
## macros.meson | ||
|
||
The spec file `slurm-uenv-mount.spec` uses macros like `%meson_setup`, which parameterise | ||
calls to meson. Macros for meson are not usually available, so we provide a definition of | ||
the macros in `macros.meson`. They have been modified from the ones provided in the | ||
following RPM: | ||
|
||
https://packages.altlinux.org/en/sisyphus/binary/rpm-macros-meson/noarch/2908824343041241330 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
Name: slurm-uenv-mount | ||
Version: UENVMNT_VERSION | ||
Release: RPM_SLURM_VERSION | ||
Summary: SLURM spank plugin to mount squashfs images. | ||
Prefix: /usr | ||
Requires: slurm = RPM_SLURM_VERSION | ||
|
||
License: BSD3 | ||
URL: https://github.com/eth-cscs/slurm-uenv-mount | ||
Source0: %{name}-%{version}.tar.gz | ||
|
||
BuildRequires: meson gcc slurm-devel | ||
|
||
%define _build_id_links none | ||
|
||
%description | ||
A SLURM spank plugin to mount squashfs images. | ||
|
||
%prep | ||
%autosetup -c | ||
|
||
%build | ||
%meson_setup | ||
%meson_build | ||
|
||
%install | ||
%meson_install | ||
|
||
%post | ||
REQ="required /usr/lib64/libslurm-uenv-mount.so" | ||
CNF=/etc/plugstack.conf.d/99-slurm-uenv-mount.conf | ||
mkdir -p /etc/plugstack.conf.d | ||
echo "$REQ" > "$CNF" | ||
|
||
%files | ||
%license LICENSE | ||
%{_libdir}/lib%{name}.so |
Oops, something went wrong.