Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check user partitions and show custom error messages #4

Merged
merged 1 commit into from
Jul 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions public/templates/user-partitions.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
#!/bin/bash
# This script lists the user's available nodes in the cluster and their load using the SLURM CLI.

# Function to print an error message and exit
error_exit() {
local error_message=$1
echo "Error: $error_message"
exit 1
}

# Function to check if the user exists
check_user_is_registered() {
local username=$1
local user_in_sacctmgr
user_in_sacctmgr=$(sacctmgr show user "$username" --noheader)
if [ -z "$user_in_sacctmgr" ]; then
error_exit "User $username does not exist."
fi
}

# Function to list all partitions QoS limits
list_partitions_qos_limits() {
sacctmgr -P -r show qos format=Name,GrpTRES --noheader || error_exit "Failed to get partitions qos limits."
Expand Down Expand Up @@ -236,6 +253,7 @@ main() {
echo "Missing username argument."
exit 1
fi
check_user_is_registered "$username"

combine_partition_data "$username"
exit 0
Expand Down