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

Adding benchmark stress module #20367

Open
wants to merge 2 commits into
base: devel
from

Conversation

Projects
None yet
7 participants
@bbyhuy
Contributor

bbyhuy commented Jan 17, 2017

ISSUE TYPE
  • New Module Pull Request
COMPONENT NAME

stress

ANSIBLE VERSION
ansible 2.2.0.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides
SUMMARY

Benchmarking is a field which automation is often sought after. By wrapping these benchmark tools (more to come) as Ansible modules, it enables people to quickly launch benchmarks remotely and at scale. Each benchmark module is formatted with essentially the same boilerplate with specific changes to just the parsing and execution portions. As much of the code is kept the same as possible as to allow adding new benchmarks to be quick and painless.

stress is a deliberately simple workload generator for POSIX systems. It imposes a configurable amount of CPU, memory, I/O, and disk stress on the system.

$: ansible all -i 'x.x.x.x,' -m stress -a 'cpu=1 timeout=10'

x.x.x.x | SUCCESS => {
    "bench_config": {
        "cpu": 1,
        "timeout": 10
    },
    "changed": true,
    "exec_cmd": "/usr/local/bin/stress --cpu 1 --timeout 10",
    "rc": 0,
    "stderr": "",
    "stdout": "stress: info: [4553] dispatching hogs: 1 cpu, 0 io, 0 vm, 0 hdd\nstress: info: [4553] successful run completed in 10s",
    "stdout_lines": [
        "stress: info: [4553] dispatching hogs: 1 cpu, 0 io, 0 vm, 0 hdd",
        "stress: info: [4553] successful run completed in 10s"
    ]
}
@bbyhuy

This comment has been minimized.

Contributor

bbyhuy commented Jan 17, 2017

referencing #19457

@gundalow

This comment has been minimized.

Contributor

gundalow commented Jan 18, 2017

@haad I believe you reviewed the original PR ansible/ansible-modules-extras#3107 Do you have any extra thoughts on this?

@gundalow

needs_revision

If this module gets run multiple times against a system will multiple stress tests be invoked? That feels like something that at a minimum needs making very clear in the documentation, or better yet detected in code

state:
description:
- Execute module to run stress or parse an existing stress result file.
required: true

This comment has been minimized.

@gundalow

gundalow Jan 18, 2017

Contributor

Please add the following so the documentation will list the acceptable choices.
choices: ['benchmark', 'parse']

required: true
timeout:
description:
- Total time to run stress for.

This comment has been minimized.

@gundalow

gundalow Jan 18, 2017

Contributor

Please document units, eg:
Total time, in seconds, to run stress for

@bbyhuy

This comment has been minimized.

Contributor

bbyhuy commented Jan 19, 2017

Added a function to check ps or psgrep for process name. Though, unless a similar function already exists, may be worthwhile adding it as a helper function for AnsibleModules? seems like something that would be useful in other cases.

@gundalow gundalow added this to the 2.5.0 milestone Feb 7, 2018

@ansibot ansibot removed the stale_ci label Feb 7, 2018

@ansibot

This comment has been minimized.

Contributor

ansibot commented Feb 7, 2018

The test ansible-test sanity --test boilerplate [?] failed with the following error:

Command "test/sanity/code-smell/boilerplate.sh" returned exit status 2.
>>> Standard Output
== Missing __metaclass__ = type ==
./lib/ansible/modules/cloud/openstack/os_project_access.py
./lib/ansible/modules/benchmarks/stress.py

== Missing from __future__ import (absolute_import, division, print_function) ==
./lib/ansible/modules/cloud/openstack/os_project_access.py
./lib/ansible/modules/benchmarks/stress.py

The test ansible-test sanity --test pep8 [?] failed with the following errors:

lib/ansible/modules/benchmarks/stress.py:135:8: E221 multiple spaces before operator
lib/ansible/modules/benchmarks/stress.py:136:12: E221 multiple spaces before operator
lib/ansible/modules/benchmarks/stress.py:137:9: E221 multiple spaces before operator
lib/ansible/modules/benchmarks/stress.py:138:11: E221 multiple spaces before operator
lib/ansible/modules/benchmarks/stress.py:156:22: E221 multiple spaces before operator
lib/ansible/modules/benchmarks/stress.py:157:23: E221 multiple spaces before operator
lib/ansible/modules/benchmarks/stress.py:158:21: E221 multiple spaces before operator
lib/ansible/modules/benchmarks/stress.py:159:21: E221 multiple spaces before operator
lib/ansible/modules/benchmarks/stress.py:160:17: E221 multiple spaces before operator
lib/ansible/modules/benchmarks/stress.py:165:9: E221 multiple spaces before operator
lib/ansible/modules/benchmarks/stress.py:198:22: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/benchmarks/stress.py:198:24: E251 unexpected spaces around keyword / parameter equals

The test ansible-test sanity --test validate-modules [?] failed with the following errors:

lib/ansible/modules/benchmarks/stress.py:0:0: E307 version_added should be 2.5. Currently 2.3
lib/ansible/modules/benchmarks/stress.py:0:0: E314 No ANSIBLE_METADATA provided
lib/ansible/modules/benchmarks/stress.py:238:0: E107 Imports should be directly below DOCUMENTATION/EXAMPLES/RETURN/ANSIBLE_METADATA.

The test ansible-test sanity --test pylint [?] failed with the following errors:

lib/ansible/modules/benchmarks/stress.py:123:42: ansible-format-automatic-specification Format string contains automatic field numbering specification
lib/ansible/modules/benchmarks/stress.py:125:42: ansible-format-automatic-specification Format string contains automatic field numbering specification
lib/ansible/modules/benchmarks/stress.py:128:29: ansible-format-automatic-specification Format string contains automatic field numbering specification
lib/ansible/modules/benchmarks/stress.py:143:28: ansible-format-automatic-specification Format string contains automatic field numbering specification
lib/ansible/modules/benchmarks/stress.py:146:28: ansible-format-automatic-specification Format string contains automatic field numbering specification
lib/ansible/modules/benchmarks/stress.py:154:15: ansible-format-automatic-specification Format string contains automatic field numbering specification
lib/ansible/modules/benchmarks/stress.py:168:29: ansible-format-automatic-specification Format string contains automatic field numbering specification
lib/ansible/modules/benchmarks/stress.py:178:0: anomalous-backslash-in-string Anomalous backslash in string: '\d'. String constant might be missing an r prefix.
lib/ansible/modules/benchmarks/stress.py:178:0: anomalous-backslash-in-string Anomalous backslash in string: '\d'. String constant might be missing an r prefix.
lib/ansible/modules/benchmarks/stress.py:178:0: anomalous-backslash-in-string Anomalous backslash in string: '\d'. String constant might be missing an r prefix.
lib/ansible/modules/benchmarks/stress.py:178:0: anomalous-backslash-in-string Anomalous backslash in string: '\d'. String constant might be missing an r prefix.
lib/ansible/modules/benchmarks/stress.py:178:0: anomalous-backslash-in-string Anomalous backslash in string: '\s'. String constant might be missing an r prefix.
lib/ansible/modules/benchmarks/stress.py:178:0: anomalous-backslash-in-string Anomalous backslash in string: '\s'. String constant might be missing an r prefix.
lib/ansible/modules/benchmarks/stress.py:178:0: anomalous-backslash-in-string Anomalous backslash in string: '\s'. String constant might be missing an r prefix.
lib/ansible/modules/benchmarks/stress.py:178:0: anomalous-backslash-in-string Anomalous backslash in string: '\s'. String constant might be missing an r prefix.
lib/ansible/modules/benchmarks/stress.py:178:0: anomalous-backslash-in-string Anomalous backslash in string: '\s'. String constant might be missing an r prefix.
lib/ansible/modules/benchmarks/stress.py:178:0: anomalous-backslash-in-string Anomalous backslash in string: '\s'. String constant might be missing an r prefix.
lib/ansible/modules/benchmarks/stress.py:178:0: anomalous-backslash-in-string Anomalous backslash in string: '\s'. String constant might be missing an r prefix.
lib/ansible/modules/benchmarks/stress.py:185:0: anomalous-backslash-in-string Anomalous backslash in string: '\d'. String constant might be missing an r prefix.
lib/ansible/modules/benchmarks/stress.py:185:0: anomalous-backslash-in-string Anomalous backslash in string: '\s'. String constant might be missing an r prefix.
lib/ansible/modules/benchmarks/stress.py:185:0: anomalous-backslash-in-string Anomalous backslash in string: '\s'. String constant might be missing an r prefix.
lib/ansible/modules/benchmarks/stress.py:189:29: ansible-format-automatic-specification Format string contains automatic field numbering specification
lib/ansible/modules/benchmarks/stress.py:223:33: ansible-format-automatic-specification Format string contains automatic field numbering specification

click here for bot help

@ansibot

This comment has been minimized.

Contributor

ansibot commented Feb 8, 2018

The test ansible-test sanity --test pylint [?] failed with the following errors:

lib/ansible/modules/benchmarks/stress.py:123:42: ansible-format-automatic-specification Format string contains automatic field numbering specification
lib/ansible/modules/benchmarks/stress.py:125:42: ansible-format-automatic-specification Format string contains automatic field numbering specification
lib/ansible/modules/benchmarks/stress.py:128:29: ansible-format-automatic-specification Format string contains automatic field numbering specification
lib/ansible/modules/benchmarks/stress.py:143:28: ansible-format-automatic-specification Format string contains automatic field numbering specification
lib/ansible/modules/benchmarks/stress.py:146:28: ansible-format-automatic-specification Format string contains automatic field numbering specification
lib/ansible/modules/benchmarks/stress.py:154:15: ansible-format-automatic-specification Format string contains automatic field numbering specification
lib/ansible/modules/benchmarks/stress.py:168:29: ansible-format-automatic-specification Format string contains automatic field numbering specification
lib/ansible/modules/benchmarks/stress.py:178:0: anomalous-backslash-in-string Anomalous backslash in string: '\d'. String constant might be missing an r prefix.
lib/ansible/modules/benchmarks/stress.py:178:0: anomalous-backslash-in-string Anomalous backslash in string: '\d'. String constant might be missing an r prefix.
lib/ansible/modules/benchmarks/stress.py:178:0: anomalous-backslash-in-string Anomalous backslash in string: '\d'. String constant might be missing an r prefix.
lib/ansible/modules/benchmarks/stress.py:178:0: anomalous-backslash-in-string Anomalous backslash in string: '\d'. String constant might be missing an r prefix.
lib/ansible/modules/benchmarks/stress.py:178:0: anomalous-backslash-in-string Anomalous backslash in string: '\s'. String constant might be missing an r prefix.
lib/ansible/modules/benchmarks/stress.py:178:0: anomalous-backslash-in-string Anomalous backslash in string: '\s'. String constant might be missing an r prefix.
lib/ansible/modules/benchmarks/stress.py:178:0: anomalous-backslash-in-string Anomalous backslash in string: '\s'. String constant might be missing an r prefix.
lib/ansible/modules/benchmarks/stress.py:178:0: anomalous-backslash-in-string Anomalous backslash in string: '\s'. String constant might be missing an r prefix.
lib/ansible/modules/benchmarks/stress.py:178:0: anomalous-backslash-in-string Anomalous backslash in string: '\s'. String constant might be missing an r prefix.
lib/ansible/modules/benchmarks/stress.py:178:0: anomalous-backslash-in-string Anomalous backslash in string: '\s'. String constant might be missing an r prefix.
lib/ansible/modules/benchmarks/stress.py:178:0: anomalous-backslash-in-string Anomalous backslash in string: '\s'. String constant might be missing an r prefix.
lib/ansible/modules/benchmarks/stress.py:185:0: anomalous-backslash-in-string Anomalous backslash in string: '\d'. String constant might be missing an r prefix.
lib/ansible/modules/benchmarks/stress.py:185:0: anomalous-backslash-in-string Anomalous backslash in string: '\s'. String constant might be missing an r prefix.
lib/ansible/modules/benchmarks/stress.py:185:0: anomalous-backslash-in-string Anomalous backslash in string: '\s'. String constant might be missing an r prefix.
lib/ansible/modules/benchmarks/stress.py:189:29: ansible-format-automatic-specification Format string contains automatic field numbering specification
lib/ansible/modules/benchmarks/stress.py:223:33: ansible-format-automatic-specification Format string contains automatic field numbering specification

The test ansible-test sanity --test boilerplate [?] failed with the following error:

Command "test/sanity/code-smell/boilerplate.sh" returned exit status 2.
>>> Standard Output
== Missing __metaclass__ = type ==
./lib/ansible/modules/benchmarks/stress.py

== Missing from __future__ import (absolute_import, division, print_function) ==
./lib/ansible/modules/benchmarks/stress.py

The test ansible-test sanity --test pep8 [?] failed with the following errors:

lib/ansible/modules/benchmarks/stress.py:135:8: E221 multiple spaces before operator
lib/ansible/modules/benchmarks/stress.py:136:12: E221 multiple spaces before operator
lib/ansible/modules/benchmarks/stress.py:137:9: E221 multiple spaces before operator
lib/ansible/modules/benchmarks/stress.py:138:11: E221 multiple spaces before operator
lib/ansible/modules/benchmarks/stress.py:156:22: E221 multiple spaces before operator
lib/ansible/modules/benchmarks/stress.py:157:23: E221 multiple spaces before operator
lib/ansible/modules/benchmarks/stress.py:158:21: E221 multiple spaces before operator
lib/ansible/modules/benchmarks/stress.py:159:21: E221 multiple spaces before operator
lib/ansible/modules/benchmarks/stress.py:160:17: E221 multiple spaces before operator
lib/ansible/modules/benchmarks/stress.py:165:9: E221 multiple spaces before operator
lib/ansible/modules/benchmarks/stress.py:198:22: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/benchmarks/stress.py:198:24: E251 unexpected spaces around keyword / parameter equals

The test ansible-test sanity --test validate-modules [?] failed with the following errors:

lib/ansible/modules/benchmarks/stress.py:0:0: E307 version_added should be 2.5. Currently 2.3
lib/ansible/modules/benchmarks/stress.py:0:0: E314 No ANSIBLE_METADATA provided
lib/ansible/modules/benchmarks/stress.py:238:0: E107 Imports should be directly below DOCUMENTATION/EXAMPLES/RETURN/ANSIBLE_METADATA.

click here for bot help

@maxamillion

This comment has been minimized.

Contributor

maxamillion commented Feb 8, 2018

I think this seems like a better candidate for a reusable role in Galaxy than a module, please help me understand what the module provides that a role would not.

@mattclay mattclay added the ci_verified label Feb 9, 2018

@ansibot ansibot added the stale_ci label Feb 17, 2018

@bcoca bcoca removed this from the 2.5.0 milestone Aug 28, 2018

@ansibot ansibot added the needs_repo label Nov 10, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment