Monitoring: Job Monitoring
11.1 Job Metrics Introduction
Most HPC administrators set up device-centric monitoring to keep track of cluster node resource use. This means that metrics are selected for devices, and the results can then be seen over a period of time. The results can be viewed as a graph or data table, according to the viewing option chosen. This is covered in Chapter 10.
The administrator can also select a job that is currently running, or that has recently run, and get metrics for nodes, memory, CPU, storage, and other resource use for the job. This is known as job monitoring, which is, as the term suggests, about job-centric rather than device-centric monitoring. Job monitoring is covered in this chapter, and uses job metrics.
For perspective, monitoring as discussed until now has been based on using devices or jobs as the buckets for which resource use values are gathered. Administrators can also gather, for resources consumed by jobs, the resources used by users (or any other classifier entity) as the buckets for the values, with the help of promQL-based queries. This is typically useful for watching over the resources used by a user (or other classifier entity) when jobs are run on the cluster. User-centric monitoring—or more generally, PromQL-based classifier-centric monitoring—for jobs is termed job accounting and is covered in Chapter 12.
11.2 Job Metrics With Cgroups
Job metrics collection uses control groups (cgroups), (section 7.10). Each job is associated with a specific cgroup that is created in each of the three base cgroups that are associated with particular cgroup controllers. The cgroup controllers are kernel components that allow metrics to be collected for processes. The PIDs of these processes are in the cgroups tasks file.
NVIDIA Base Command Manager 11 uses the following cgroup controllers:
-
blkio: provides block device metrics, -
cpuacct: provides CPU usage metrics, -
memory: provides memory usage metrics.
In NVIDIA Base Command Manager before version 9.1, each job had to be put by a workload manager into a unique cgroup. However, from NVIDIA Base Command Manager 9.1 onward, this no longer necessary. By default, BCM still configures all supported workload managers to run jobs in cgroups, but it is now CMDaemon that manages the cgroup life cycle. Thus, CMDaemon ensures that:
-
the necessary cgroups are created per job
-
ensures that the cgroups are removed after the job is finished
-
and that the last values of the metrics are collected.
Even if the administrator completely disables cgroups management in the workload manager, CMDaemon can still create and remove the three cgroups associated with the job, with each of those cgroups associated with one of the three previously-mentioned cgroup controllers.
If the workload manager creates some (or all three) cgroups for a job, then CMDaemon does not try to recreate the cgroup, but does take charge of the removal of cgroups.
In NVIDIA Base Command Manager before version 9.1, cm-wlm-setup configured systemd to use a joined cgroup with the following parameter settings:
Example
Currently this is not needed. However, if this setting remains, then CMDaemon can still collect job metrics. In order to reset the cgroup layout to the default one, the administrator can run:
This command removes the JoinControllers parameter and regenerates initrd. A reboot of the nodes is required after this.
When a job is started CMDaemon detects all the job processes. CMDaemon then ensures that the required cgroups are created, and allocates the detected processes to those cgroups. CMDaemon does not configure the cgroups in any way—this is the responsibility of the workload manager.
The tables in Appendix G.1.8 list the job metrics that BCM can monitor and visualize.
If job metrics are set up (section 11.4), then:
-
on virtual machines, block device metrics may be unavailable because of virtualization.
-
for now, the metrics are retrieved from cgroups created by the workload manager for each job. When the job is finished the cgroup is removed from the filesystem along with all the collected data. Retrieving the jobs metric data therefore means that CMDaemon must sample the cgroup metrics before the job is finished. If CMDaemon is not running during a time period for any reason, then the metrics for that time period cannot be collected, even if CMDaemon starts later.
-
block device metrics are collected for each block device by default. Thus, if there are N block devices, then there are N collected block device metrics. The monitored block devices can be excluded by configuration as indicated in section 11.4.
11.3 Job Information Retention
Each job adds a set of metric values to the monitoring data. The longer a job runs, the more data is added to the data. By default, old values are cleaned up from the database in order to limit its size. In NVIDIA Base Command Manager 11 there are several advanced configuration directives to control the job data retention, with names and default values as follows:
These directives are described in detail in Appendix C.109, here.
11.4 Job Metrics Sampling Configuration
Job metrics sampling can be configured to varying degrees. For clusters where hundreds of thousands of jobs are run in a day it often makes little sense to monitor jobs, and it is often helpful to disable the JobSampler and JobMetadataSampler data producers:
Example
An alternative is to use the equivalent CMDaemon directive JobInformationDisabled, as explained here.
If however CMDaemon is to keep the monitoring data, then the collection of job metrics is carried out from the cgroups in which a job runs. The administrator can tune some low level metric collection options for the JobSampler data producer in the jobmetricsettings submode:
Example
The configuration parameters are:
The amount of monitoring data gathered can also be reduced by reducing the Maximal age and Maximal samples for data producers (section 10.4.1) to smaller, but still non-zero values. A way to do this is described in section 14.8.4.
11.4.1 The Job Metrics Collection Processing Mechanism
11.4.1.1 The cm-cgroup-job-keepalive Process
From NVIDIA Base Command Manager 9.0 onward, when a WLM job starts, CMDaemon tracks the moment it starts and finishes, and is able to collect metrics for it. As part of this enhanced jobs metrics collection, a keepalive process, cm-cgroup-job-keepalive, is run for each job. Each keepalive process is a temporary process, and is added by CMDaemon to the same cgroup that the original job was placed in by the WLM.
The process cm-cgroup-job-keepalive itself does no work. It sleeps, and by existing it prevents its cgroup being deleted.
After a job is finished, the workload manager would normally remove the related cgroup. However the existence of the cm-cgroup-job-keepalive process prevents the deletion. This allows CMDaemon to collect the very last metrics data for the job from the cgroup when the job finishes. The CMDaemon then stops the cm-cgroup-job-keepalive process, and the cgroup is then removed because it is no longer needed.
When CMDaemon starts the cm-cgroup-job-keepalive process for a job, it passes the appropriate job ID, and how long it can run, in its command line options. Those values are not used by the cm-cgroup-job-keepalive process itself, but they are convenient for seeing what job the process is running for, and how long the job has run since it was started. For example, for a Slurm job with id 2 the running cgroup keeper process could look like:
Example
(The cut command is just used in the example to cut out the middle bits of the output so that it fits the page format well).
11.4.1.2 The Keep Alive Sleep Time
By default the cgroup keeper process stops after 8 weeks. This value should be increased if the jobs that are expected to run will take longer than 8 weeks. The value can be set in the Keep Alive Sleep parameter of the job metrics settings. If a job runs for longer than the value of Keep Alive Sleep, then CMDaemon cannot collect the very last metrics (from around the time that the job has finished). However all other metrics will be collected for the job as expected, even if the job running time exceeds the Keep Alive Sleep time.
11.4.1.3 The OOB intervals Parameter
When metric collection for a new job has just started, CMDaemon samples more frequently than later on. This more frequent sampling behaviour is defined by the parameter OOB intervals (out of band sampling interval) in the data producer configuration. In the case of job metrics collection this more frequent sampling behaviour is in JobSampler.
By default, the sampling interval returns to the standard Interval value (with a default value of 120s), as defined in the data producer settings, after the value of Pickup times (with a default value of 12) has been exceeded.
The parameter Exclude Metrics can be used to exclude metrics that are currently enabled. For example, if advanced metrics collection is enabled then Exclude Metrics allows either default or advanced metrics to be excluded by name.
11.5 Job Monitoring In cmsh
The following commands are associated with monitoring job measurables within jobs submode (cmsh > wlm<[workload manager]> > jobs, section 7.7):
11.5.0.1 The measurables Command
A list of job-associated measurables can be seen in the jobs submode (cmsh > [<workload manager]> > jobs) using the measurables command with a job ID. For example (much output elided):
Example
A list of node-associated measurables can also be seen if the -n option is used (much output elided):
Example
11.5.0.2 The filter Command
The filter command uses options to provide filtered historic job-related information. It does not provide measurables data. The command and its options can be used to:
-
retrieve running, pending, failed or finished jobs information
-
select job data using regular expressions to filter by job ID
-
list jobs by user name, user group, or workload manager
Running filter without options simply lists an unfiltered list.
Filtering on a job name can be done with the -n|--name option, and the --limit option can be used to limit the number of results displayed:
Example
The data shown is retrieved from the running workload manager, as well as from the accounting file or database maintained by the workload manager.
Further details on the options to filter can be seen by running help filter.
11.5.0.3 The info Command
A handy command to obtain job information is info, followed by the job number:
Example
11.5.0.4 The dumpmonitoringdata Command
The dumpmonitoringdata command displays data for measurables in the jobs submode (cmsh > [<workload manager]> > jobs). It is a very similar to the dumpmonitoringdata command for measurables in device mode (section 10.6.4). The main difference in the behavior of dumpmonitoringdata for these modes is that:
-
In the
jobssubmode it shows monitoring data over a period of time for a specified job ID -
In
devicemode (cmsh > device) it shows monitoring data over a period of time for a specified device.
A less obvious difference is that:
-
In the
jobssubmode the start and end time for the monitoring data for the job does not need to be specified. By default the start and end time of the job is assumed. -
In
devicemode the start and end time for the monitoring data for the device must be specified
The usage of the dumpmonitoringdata command for job measurables is:
dumpmonitoringdata [OPTIONS] [ <start-time> <end-time>] <measurable> <job ID>
Options allow measurables to be retrieved and presented in various ways, including by maximum value, raw or interpolated data, and human-friendly forms. The user can also specify custom periods for the options.
For example, a historical job with job ID 4 that uses nodes node001 and node002 might display output for the job-associated measurable memory.usage as follows:
Example
The start and end times are optional, so specifying them is typically unnecessary. If they are not specified, then the data values that were found over the entire period of the job run are displayed.
That job with ID 26, for the example used in this section 11.5, happens to be mgbench, a GPU benchmarking program that runs on nodes. So displaying output for the node-associated measurable, gpu_power_usage, during the job run can also be useful:
Example
The data is shown per node if the job uses several nodes.
Further details of the options to dumpmonitoringdata for job metrics can be seen by running help dumpmonitoringdata within jobs mode.
11.5.0.5 The statistics Command
The statistics command shows basic statistics for historical job information. It allows statistics to be filtered per user or user group, and workload manager. The statistics can be grouped by hour, day, week or a custom interval.
Example
Further details of the options to statistics can be seen by running help statistics.