%define name sausage-api %define version 0.1.2 %define unmangled_version 0.1.2 %define release 1 Summary: SLURM account usage API Name: %{name} Version: %{version} Release: %{release} Source0: %{name}-%{unmangled_version}.tar.gz License: GPLv3 Group: Application/System BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot Prefix: %{_prefix} BuildArch: noarch Vendor: ECOLE POLYTECHNIQUE FEDERALE DE LAUSANNE Url: https://c4science.ch/source/sausage-api/ BuildRequires: python3-setuptools, python36-falcon3, python36-gunicorn, python36-elasticsearch6 Requires: python36-falcon3, python36-gunicorn, python36-elasticsearch6 %description SLURM account usage Falcon API service This project implements a Falcon API service to display CPU / GPU consumption per account in a Slurm cluster. The service queries the elastic instance created by the jobcomp/elasticsearch plugin provided by SchedMD. %prep %setup -n %{name}-%{unmangled_version} -n %{name}-%{unmangled_version} %build python3 setup.py build %install python3 setup.py install --single-version-externally-managed -O1 --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES /usr/bin/mkdir -p %{buildroot}/etc/systemd/system/ /usr/bin/mkdir -p %{buildroot}/etc/sausage/ install -m 755 sausage_api.service %{buildroot}/etc/systemd/system/ install -m 644 sausage-api.cfg %{buildroot}/etc/sausage/ install -m 644 sausage-api.json %{buildroot}/etc/sausage/ %clean rm -rf $RPM_BUILD_ROOT %files -f INSTALLED_FILES %defattr(-,root,root) /etc/systemd/system/sausage_api.service /etc/sausage/sausage-api.cfg /etc/sausage/sausage-api.json %pre getent group sausage >/dev/null || groupadd -r sausage getent passwd sausage >/dev/null || useradd -r -g sausage -d /var/spool/sausage -s /sbin/nologin sausage %post %if 0%{?rhel} < 8 /bin/systemctl --system daemon-reload &> /dev/null /bin/systemctl --system enable sausage_api &> /dev/null %endif %postun %if 0%{?rhel} < 8 /bin/systemctl --system daemon-reload &> /dev/nul %endif