How to use the command 'sacctmgr' (with examples)
- Linux
- November 5, 2023
The sacctmgr
command is used to view, setup, and manage Slurm accounts. It provides functionality to query and modify the configuration of Slurm clusters, accounts, users, and associations.
Use case 1: Show current configuration
Code:
sacctmgr show configuration
Motivation: This use case allows users to view the current configuration of the Slurm cluster, which can be helpful for troubleshooting or verifying settings.
Explanation: The show configuration
subcommand is used to display the current configuration of the Slurm cluster. In this case, the sacctmgr
command is used with the show
subcommand followed by configuration
argument.
Example Output:
ClusterName=cluster1
ClusterAdmin=root@localhost
Use case 2: Add a cluster to the slurm database
Code:
sacctmgr add cluster cluster_name
Motivation: This use case is useful when you want to add a new cluster to the Slurm database, allowing it to be managed using sacctmgr
.
Explanation: The add cluster
subcommand is used to add a new cluster to the Slurm database. In this case, the sacctmgr
command is used with the add
subcommand followed by cluster
and the name of the cluster to be added.
Example Output: N/A
Use case 3: Add an account to the slurm database
Code:
sacctmgr add account account_name cluster=cluster_of_account
Motivation: This use case allows users to add an account to the Slurm database, enabling resource allocation and management for specific groups or projects.
Explanation: The add account
subcommand is used to add a new account to the Slurm database. In this case, the sacctmgr
command is used with the add
subcommand followed by account
and the name of the account to be added. The cluster
argument specifies which cluster the account belongs to.
Example Output: N/A
Use case 4: Show details of user/association/cluster/account using a specific format
Code:
sacctmgr show user|association|cluster|account format="Account%10" format="GrpTRES%30"
Motivation: This use case allows users to retrieve and display details of users, associations, clusters, or accounts in a specific format, which can help in creating reports or extracting relevant information.
Explanation: The show user|association|cluster|account
subcommand is used to display details of users, associations, clusters, or accounts. In this case, the sacctmgr
command is used with the show
subcommand followed by either user
, association
, cluster
, or account
. The format
argument specifies the specific format to be used for displaying the output.
Example Output:
Account GrpTRES
test cpu=100,mem=100M
Conclusion:
The sacctmgr
command is a powerful tool for viewing, setting up, and managing Slurm accounts. It provides an extensive range of functionality for configuration management, adding clusters, accounts, and showing details in specific formats. Understanding how to use these different use cases can enable users to effectively manage and monitor their Slurm clusters.