/sacct-observer

Job history observer for remote HPC clusters with Slurm job scheduler.

Primary LanguageGoMIT LicenseMIT

sacct-observer

An observer that fetches the job history with the "sacct" command of the Slurm workload manager and saves it in a SQLite3 database. Can be useful to integrate it in microservices which launch jobs in HPC clusters where Slurm is used as a job scheduler. The reason why it saves the records in a light database, because usually the content of the "sacct" command gets deleted periodically.

Table of content


Installation with a pre-built binary

Download the corresponding binary to your system from the assets below and put it into your PATH to make it a globally available executable.

Download binary here

NOTE: Ensure that your system has a globally installed and available SSH and SQLITE3 client.

EXAMPLE:

mkdir -p ~/.local/bin
cp ./path/to/sacct-observer-binary ~/.local/bin/sacct-observer
chmod u+x ~/.local/bin/sacct-observer

MAKE SURE THAT "~/.local/bin" is in your PATH!

# Check your PATH variable.
echo $PATH | grep $HOME/.local/bin

# If no result printed as output, then:
echo "export PATH=\$PATH:$HOME/.local/bin" >> $HOME/.bashrc
source $HOME/.bashrc

NOTE: If you want autocomplete for your bash shell, then run the following pipe:

rm -r /tmp/sacct-observer \
&& git clone https://github.com/heloint/sacct-observer /tmp/sacct-observer \
&& cd /tmp/sacct-observer \
&& make get-autocomplete \
&& cd -

Installation from source

NOTE: Ensure that your system has a globally installed and available SSH and SQLITE3 client.

1. Clone the repository

git clone https://github.com/heloint/sacct-observer

2. Build the binary (latest Go compiler is required)

make build

OR use Docker to build the binary

docker build -t sacct-observer:latest . \
&& mkdir -p ./bin \
&& id=$(docker create sacct-observer:latest) \
&& docker cp $id:/app/bin/sacct-observer - > ./bin/sacct-observer \
&& docker rm -v $id

3. Make the binary available for the session's user.

make install

4. (optional) Enable autocomplete for the CLI flags. <a id="enable-autocomplete />

make get-autocomplete

Usage

sacct-observer --username "my_remote_username" \
               --remote-address "my_cluster.org" \
               --output-sqlite-db "/path/to/create/my_sqlite.db" \
               --update-frequency 30