How to use the command 'sstat' (with examples)

How to use the command 'sstat' (with examples)

The ‘sstat’ command is used to view information about running jobs in the Slurm workload manager. It provides various options to display different types of information about the jobs, such as their status, resource usage, and so on.

Use case 1: Display status information of a comma-separated list of jobs

Code:

sstat --jobs=job_id

Motivation: This use case is useful when you want to quickly check the status of specific jobs running in the Slurm workload manager.

Explanation:

  • --jobs=job_id: This argument is used to specify the comma-separated list of job IDs for which you want to display the status information.

Example output:

JobID  JobName     State
1      job1        RUNNING
2      job2        COMPLETED
3      job3        PENDING

Use case 2: Display job ID, average CPU, and average virtual memory size of a comma-separated list of jobs, with pipes as column delimiters

Code:

sstat --parsable --jobs=job_id --format=JobID,AveCPU,AveVMSize

Motivation: This use case is useful when you want to extract specific information about the resource usage of jobs in a machine-readable format, such as for further analysis or processing.

Explanation:

  • --parsable: This argument is used to enable the parsable output format, which means the output will be in a machine-readable format.
  • --jobs=job_id: This argument is used to specify the comma-separated list of job IDs for which you want to display the information.
  • --format=JobID,AveCPU,AveVMSize: This argument is used to specify the fields that you want to display for each job. In this example, it will display the job ID, average CPU, and average virtual memory size.

Example output:

1|12.34|567890
2|10.12|345678
3|8.56|234567

Use case 3: Display list of fields available

Code:

sstat --helpformat

Motivation: This use case is useful when you want to know the available fields that can be used in the --format argument for customizing the output.

Explanation:

  • --helpformat: This argument is used to display the list of fields available for customization in the --format argument.

Example output:

JobID
JobName
State
AveCPU
AveVMSize
...

Conclusion:

The ‘sstat’ command in Slurm provides a powerful way to view information about running jobs, including their status and resource usage. By using different options and arguments, you can customize the output to suit your needs, whether it is to quickly check the status of specific jobs, extract specific information in a machine-readable format, or explore the available fields for customization.

Related Posts

How to use the command 'act' (with examples)

How to use the command 'act' (with examples)

The ‘act’ command is a tool that allows you to execute GitHub Actions locally using Docker.

Read More
How to use the command 'pacman --database' (with examples)

How to use the command 'pacman --database' (with examples)

The ‘pacman –database’ command allows users to operate on the Arch Linux package database.

Read More
How to use the command 'nix edit' (with examples)

How to use the command 'nix edit' (with examples)

The ’nix edit’ command allows you to open the Nix expression of a Nix package in your chosen text editor.

Read More