cgroup_perf_recap – Profiles system activity of tasks and full execution using cgroups¶
New in version 2.8.
Synopsis¶
This is an ansible callback plugin utilizes cgroups to profile system activity of ansible and individual tasks, and display a recap at the end of the playbook execution
Requirements¶
The below requirements are needed on the local master node that executes this callback.
whitelist in configuration
cgroups
Parameters¶
Parameter | Choices/Defaults | Configuration | Comments |
---|---|---|---|
control_group
-
/ required
|
ini entries:
[callback_cgroup_perf_recap] env:CGROUP_CONTROL_GROUP
|
Name of cgroups control group
|
|
cpu_poll_interval
float
|
Default: 0.25
|
ini entries:
[callback_cgroup_perf_recap] env:CGROUP_CPU_POLL_INTERVAL
|
Interval between CPU polling for determining CPU usage. A lower value may produce inaccurate results, a higher value may not be short enough to collect results for short tasks.
|
display_recap
boolean
|
|
ini entries:
[callback_cgroup_perf_recap] env:CGROUP_DISPLAY_RECAP
|
Controls whether the recap is printed at the end, useful if you will automatically process the output files
|
file_name_format
string
|
Default: "%(feature)s.%(ext)s"
|
ini entries:
[callback_cgroup_perf_recap] env:CGROUP_FILE_NAME_FORMAT
|
Format of filename. Accepts
%(counter s), %(task_uuid s), %(feature s), %(ext s). Defaults to %(feature s.%(ext)s) when file_per_task is False and %(counter s-%(task_uuid)s-%(feature)s.%(ext)s) when True |
file_per_task
boolean
|
|
ini entries:
[callback_cgroup_perf_recap] env:CGROUP_FILE_PER_TASK
|
When set as
True along with write_files , this callback will write 1 file per task instead of 1 file for the entire playbook run |
memory_poll_interval
float
|
Default: 0.25
|
ini entries:
[callback_cgroup_perf_recap] env:CGROUP_MEMORY_POLL_INTERVAL
|
Interval between memory polling for determining memory usage. A lower value may produce inaccurate results, a higher value may not be short enough to collect results for short tasks.
|
output_dir
path
|
Default: "/tmp/ansible-perf-%s"
|
ini entries:
[callback_cgroup_perf_recap] env:CGROUP_OUTPUT_DIR
|
Output directory for files containing recorded performance readings. If the value contains a single %s, the start time of the playbook run will be inserted in that space. Only the deepest level directory will be created if it does not exist, parent directories will not be created.
|
output_format
string
|
|
ini entries:
[callback_cgroup_perf_recap] env:CGROUP_OUTPUT_FORMAT
|
Output format, either CSV or JSON-seq
|
pid_poll_interval
float
|
Default: 0.25
|
ini entries:
[callback_cgroup_perf_recap] env:CGROUP_PID_POLL_INTERVAL
|
Interval between PID polling for determining PID count. A lower value may produce inaccurate results, a higher value may not be short enough to collect results for short tasks.
|
write_files
boolean
|
|
ini entries:
[callback_cgroup_perf_recap] env:CGROUP_WRITE_FILES
|
Dictates whether files will be written containing performance readings
|
Notes¶
Note
Requires ansible to be run from within a cgroup, such as with
cgexec -g cpuacct,memory,pids:ansible_profile ansible-playbook ...
This cgroup should only be used by ansible to get accurate results
To create the cgroup, first use a command such as
sudo cgcreate -a ec2-user:ec2-user -t ec2-user:ec2-user -g cpuacct,memory,pids:ansible_profile
Status¶
This callback is not guaranteed to have a backwards compatible interface. [preview]
This callback is maintained by the Ansible Community. [community]