Skip to content

Commit

Permalink
Remove resource profiling feature
Browse files Browse the repository at this point in the history
  • Loading branch information
shanemcd committed Apr 20, 2021
1 parent 182d4d3 commit 47142b7
Show file tree
Hide file tree
Showing 11 changed files with 0 additions and 232 deletions.
43 changes: 0 additions & 43 deletions awx/main/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,49 +344,6 @@
category_slug='jobs',
)

register(
'AWX_RESOURCE_PROFILING_ENABLED',
field_class=fields.BooleanField,
default=False,
label=_('Enable detailed resource profiling on all playbook runs'),
help_text=_('If set, detailed resource profiling data will be collected on all jobs. ' 'This data can be gathered with `sosreport`.'), # noqa
category=_('Jobs'),
category_slug='jobs',
)

register(
'AWX_RESOURCE_PROFILING_CPU_POLL_INTERVAL',
field_class=FloatField,
default='0.25',
label=_('Interval (in seconds) between polls for cpu usage.'),
help_text=_('Interval (in seconds) between polls for cpu usage. ' 'Setting this lower than the default will affect playbook performance.'),
category=_('Jobs'),
category_slug='jobs',
required=False,
)

register(
'AWX_RESOURCE_PROFILING_MEMORY_POLL_INTERVAL',
field_class=FloatField,
default='0.25',
label=_('Interval (in seconds) between polls for memory usage.'),
help_text=_('Interval (in seconds) between polls for memory usage. ' 'Setting this lower than the default will affect playbook performance.'),
category=_('Jobs'),
category_slug='jobs',
required=False,
)

register(
'AWX_RESOURCE_PROFILING_PID_POLL_INTERVAL',
field_class=FloatField,
default='0.25',
label=_('Interval (in seconds) between polls for PID count.'),
help_text=_('Interval (in seconds) between polls for PID count. ' 'Setting this lower than the default will affect playbook performance.'),
category=_('Jobs'),
category_slug='jobs',
required=False,
)

register(
'AWX_TASK_ENV',
field_class=fields.KeyValueField,
Expand Down
44 changes: 0 additions & 44 deletions awx/main/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -997,36 +997,6 @@ def build_extra_vars_file(self, instance, private_data_dir):
Build ansible yaml file filled with extra vars to be passed via -e@file.yml
"""

def build_params_resource_profiling(self, instance, private_data_dir):
resource_profiling_params = {}
if self.should_use_resource_profiling(instance):
cpu_poll_interval = settings.AWX_RESOURCE_PROFILING_CPU_POLL_INTERVAL
mem_poll_interval = settings.AWX_RESOURCE_PROFILING_MEMORY_POLL_INTERVAL
pid_poll_interval = settings.AWX_RESOURCE_PROFILING_PID_POLL_INTERVAL

results_dir = os.path.join(private_data_dir, 'artifacts/playbook_profiling')
if not os.path.isdir(results_dir):
os.makedirs(results_dir, stat.S_IREAD | stat.S_IWRITE | stat.S_IEXEC)
# FIXME: develop some better means of referencing paths inside containers
container_results_dir = os.path.join('/runner', 'artifacts/playbook_profiling')

logger.debug(
'Collected the following resource profiling intervals: cpu: {} mem: {} pid: {}'.format(cpu_poll_interval, mem_poll_interval, pid_poll_interval)
)

resource_profiling_params.update(
{
'resource_profiling': True,
'resource_profiling_base_cgroup': 'ansible-runner',
'resource_profiling_cpu_poll_interval': cpu_poll_interval,
'resource_profiling_memory_poll_interval': mem_poll_interval,
'resource_profiling_pid_poll_interval': pid_poll_interval,
'resource_profiling_results_dir': container_results_dir,
}
)

return resource_profiling_params

def _write_extra_vars_file(self, private_data_dir, vars, safe_dict={}):
env_path = os.path.join(private_data_dir, 'env')
try:
Expand Down Expand Up @@ -1070,12 +1040,6 @@ def build_env(self, instance, private_data_dir, isolated, private_data_files=Non

return env

def should_use_resource_profiling(self, job):
"""
Return whether this task should use resource profiling
"""
return False

def build_inventory(self, instance, private_data_dir):
script_params = dict(hostvars=True, towervars=True)
if hasattr(instance, 'job_slice_number'):
Expand Down Expand Up @@ -1371,7 +1335,6 @@ def run(self, pk, **kwargs):
passwords = self.build_passwords(self.instance, kwargs)
self.build_extra_vars_file(self.instance, private_data_dir)
args = self.build_args(self.instance, private_data_dir, passwords)
resource_profiling_params = self.build_params_resource_profiling(self.instance, private_data_dir)
env = self.build_env(self.instance, private_data_dir, isolated, private_data_files=private_data_files)
self.safe_env = build_safe_env(env)

Expand All @@ -1398,7 +1361,6 @@ def run(self, pk, **kwargs):
'settings': {
'job_timeout': self.get_instance_timeout(self.instance),
'suppress_ansible_output': True,
**resource_profiling_params,
},
}

Expand Down Expand Up @@ -1742,12 +1704,6 @@ def get_password_prompts(self, passwords={}):
d[r'Vault password \({}\):\s*?$'.format(vault_id)] = k
return d

def should_use_resource_profiling(self, job):
"""
Return whether this task should use resource profiling
"""
return settings.AWX_RESOURCE_PROFILING_ENABLED

def build_execution_environment_params(self, instance, private_data_dir):
if settings.IS_K8S:
return {}
Expand Down
26 changes: 0 additions & 26 deletions awx/main/tests/unit/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,32 +539,6 @@ class MockMe:
1, job_args=json.dumps({'foo': 'bar'}), job_cwd='/foobar', job_env={'switch': 'blade', 'foot': 'ball', 'secret_key': 'redacted_value'}
)

@mock.patch('os.makedirs')
def test_build_params_resource_profiling(self, os_makedirs):
job = Job(project=Project(), inventory=Inventory())
task = tasks.RunJob()
task.should_use_resource_profiling = lambda job: True
task.instance = job

resource_profiling_params = task.build_params_resource_profiling(task.instance, '/fake_private_data_dir')
assert resource_profiling_params['resource_profiling'] is True
assert resource_profiling_params['resource_profiling_base_cgroup'] == 'ansible-runner'
assert resource_profiling_params['resource_profiling_cpu_poll_interval'] == '0.25'
assert resource_profiling_params['resource_profiling_memory_poll_interval'] == '0.25'
assert resource_profiling_params['resource_profiling_pid_poll_interval'] == '0.25'
assert resource_profiling_params['resource_profiling_results_dir'] == '/runner/artifacts/playbook_profiling'

@pytest.mark.parametrize("scenario, profiling_enabled", [('global_setting', True), ('default', False)])
def test_should_use_resource_profiling(self, scenario, profiling_enabled, settings):
job = Job(project=Project(), inventory=Inventory())
task = tasks.RunJob()
task.instance = job

if scenario == 'global_setting':
settings.AWX_RESOURCE_PROFILING_ENABLED = True

assert task.should_use_resource_profiling(task.instance) == profiling_enabled

def test_created_by_extra_vars(self):
job = Job(created_by=User(pk=123, username='angry-spud'))

Expand Down
12 changes: 0 additions & 12 deletions awx/settings/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,18 +592,6 @@ def IS_TESTING(argv=None):
# Note: This setting may be overridden by database settings.
AWX_ISOLATION_BASE_PATH = "/tmp"

# Disable resource profiling by default
AWX_RESOURCE_PROFILING_ENABLED = False

# Interval (in seconds) between polls for cpu usage
AWX_RESOURCE_PROFILING_CPU_POLL_INTERVAL = '0.25'

# Interval (in seconds) between polls for memory usage
AWX_RESOURCE_PROFILING_MEMORY_POLL_INTERVAL = '0.25'

# Interval (in seconds) between polls for PID count
AWX_RESOURCE_PROFILING_PID_POLL_INTERVAL = '0.25'

# User definable ansible callback plugins
# Note: This setting may be overridden by database settings.
AWX_ANSIBLE_CALLBACK_PLUGINS = ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@ describe('<JobsDetail />', () => {
assertDetail(wrapper, 'Isolated launch timeout', '600 seconds');
assertDetail(wrapper, 'Isolated connection timeout', '10 seconds');
assertDetail(wrapper, 'Isolated host key checking', 'Off');
assertDetail(
wrapper,
'Enable detailed resource profiling on all playbook runs',
'Off'
);
assertDetail(wrapper, 'Run Project Updates With Higher Verbosity', 'Off');
assertDetail(wrapper, 'Enable Role Download', 'On');
assertDetail(wrapper, 'Enable Collection(s) Download', 'On');
Expand Down
4 changes: 0 additions & 4 deletions awx/ui_next/src/screens/Setting/Jobs/JobsEdit/JobsEdit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,6 @@ function JobsEdit() {
name="AWX_ISOLATED_HOST_KEY_CHECKING"
config={jobs.AWX_ISOLATED_HOST_KEY_CHECKING}
/>
<BooleanField
name="AWX_RESOURCE_PROFILING_ENABLED"
config={jobs.AWX_RESOURCE_PROFILING_ENABLED}
/>
<InputField
name="AWX_ISOLATED_CHECK_INTERVAL"
config={jobs.AWX_ISOLATED_CHECK_INTERVAL}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@
"AWX_ISOLATED_LAUNCH_TIMEOUT": 600,
"AWX_ISOLATION_BASE_PATH": "/tmp",
"AWX_ISOLATION_SHOW_PATHS": [],
"AWX_RESOURCE_PROFILING_CPU_POLL_INTERVAL": 0.25,
"AWX_RESOURCE_PROFILING_ENABLED": false,
"AWX_RESOURCE_PROFILING_MEMORY_POLL_INTERVAL": 0.25,
"AWX_RESOURCE_PROFILING_PID_POLL_INTERVAL": 0.25,
"AWX_ROLES_ENABLED": true,
"AWX_SHOW_PLAYBOOK_LINKS": false,
"AWX_TASK_ENV": {},
Expand Down
68 changes: 0 additions & 68 deletions awx/ui_next/src/screens/Setting/shared/data.allSettingOptions.json
Original file line number Diff line number Diff line change
Expand Up @@ -247,38 +247,6 @@
"category_slug": "jobs",
"defined_in_file": false
},
"AWX_RESOURCE_PROFILING_ENABLED": {
"type": "boolean",
"label": "Enable detailed resource profiling on all playbook runs",
"help_text": "If set, detailed resource profiling data will be collected on all jobs. This data can be gathered with `sosreport`.",
"category": "Jobs",
"category_slug": "jobs",
"defined_in_file": false
},
"AWX_RESOURCE_PROFILING_CPU_POLL_INTERVAL": {
"type": "float",
"label": "Interval (in seconds) between polls for cpu usage.",
"help_text": "Interval (in seconds) between polls for cpu usage. Setting this lower than the default will affect playbook performance.",
"category": "Jobs",
"category_slug": "jobs",
"defined_in_file": false
},
"AWX_RESOURCE_PROFILING_MEMORY_POLL_INTERVAL": {
"type": "float",
"label": "Interval (in seconds) between polls for memory usage.",
"help_text": "Interval (in seconds) between polls for memory usage. Setting this lower than the default will affect playbook performance.",
"category": "Jobs",
"category_slug": "jobs",
"defined_in_file": false
},
"AWX_RESOURCE_PROFILING_PID_POLL_INTERVAL": {
"type": "float",
"label": "Interval (in seconds) between polls for PID count.",
"help_text": "Interval (in seconds) between polls for PID count. Setting this lower than the default will affect playbook performance.",
"category": "Jobs",
"category_slug": "jobs",
"defined_in_file": false
},
"AWX_TASK_ENV": {
"type": "nested object",
"label": "Extra Environment Variables",
Expand Down Expand Up @@ -3212,42 +3180,6 @@
"category_slug": "jobs",
"default": false
},
"AWX_RESOURCE_PROFILING_ENABLED": {
"type": "boolean",
"required": false,
"label": "Enable detailed resource profiling on all playbook runs",
"help_text": "If set, detailed resource profiling data will be collected on all jobs. This data can be gathered with `sosreport`.",
"category": "Jobs",
"category_slug": "jobs",
"default": false
},
"AWX_RESOURCE_PROFILING_CPU_POLL_INTERVAL": {
"type": "float",
"required": false,
"label": "Interval (in seconds) between polls for cpu usage.",
"help_text": "Interval (in seconds) between polls for cpu usage. Setting this lower than the default will affect playbook performance.",
"category": "Jobs",
"category_slug": "jobs",
"default": 0.25
},
"AWX_RESOURCE_PROFILING_MEMORY_POLL_INTERVAL": {
"type": "float",
"required": false,
"label": "Interval (in seconds) between polls for memory usage.",
"help_text": "Interval (in seconds) between polls for memory usage. Setting this lower than the default will affect playbook performance.",
"category": "Jobs",
"category_slug": "jobs",
"default": 0.25
},
"AWX_RESOURCE_PROFILING_PID_POLL_INTERVAL": {
"type": "float",
"required": false,
"label": "Interval (in seconds) between polls for PID count.",
"help_text": "Interval (in seconds) between polls for PID count. Setting this lower than the default will affect playbook performance.",
"category": "Jobs",
"category_slug": "jobs",
"default": 0.25
},
"AWX_TASK_ENV": {
"type": "nested object",
"required": false,
Expand Down
4 changes: 0 additions & 4 deletions awx/ui_next/src/screens/Setting/shared/data.allSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@
"AWX_ISOLATED_KEY_GENERATION":true,
"AWX_ISOLATED_PRIVATE_KEY":"",
"AWX_ISOLATED_PUBLIC_KEY":"",
"AWX_RESOURCE_PROFILING_ENABLED":false,
"AWX_RESOURCE_PROFILING_CPU_POLL_INTERVAL":0.25,
"AWX_RESOURCE_PROFILING_MEMORY_POLL_INTERVAL":0.25,
"AWX_RESOURCE_PROFILING_PID_POLL_INTERVAL":0.25,
"AWX_TASK_ENV":{},
"INSIGHTS_TRACKING_STATE":false,
"PROJECT_UPDATE_VVV":false,
Expand Down
4 changes: 0 additions & 4 deletions awx/ui_next/src/screens/Setting/shared/data.jobSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
"AWX_ISOLATED_KEY_GENERATION": true,
"AWX_ISOLATED_PRIVATE_KEY": "",
"AWX_ISOLATED_PUBLIC_KEY": "",
"AWX_RESOURCE_PROFILING_ENABLED": false,
"AWX_RESOURCE_PROFILING_CPU_POLL_INTERVAL": 0.25,
"AWX_RESOURCE_PROFILING_MEMORY_POLL_INTERVAL": 0.25,
"AWX_RESOURCE_PROFILING_PID_POLL_INTERVAL": 0.25,
"AWX_TASK_ENV": {},
"PROJECT_UPDATE_VVV": false,
"AWX_ROLES_ENABLED": true,
Expand Down
18 changes: 0 additions & 18 deletions docs/performance_data.md

This file was deleted.

0 comments on commit 47142b7

Please sign in to comment.