diff --git a/awx/main/conf.py b/awx/main/conf.py index 5c5df722186c..d0bc83610938 100644 --- a/awx/main/conf.py +++ b/awx/main/conf.py @@ -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, diff --git a/awx/main/tasks.py b/awx/main/tasks.py index 411e4b27b638..cdb20ccf0bef 100644 --- a/awx/main/tasks.py +++ b/awx/main/tasks.py @@ -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: @@ -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'): @@ -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) @@ -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, }, } @@ -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 {} diff --git a/awx/main/tests/unit/test_tasks.py b/awx/main/tests/unit/test_tasks.py index 5d600548a32d..b9e6f5e8c385 100644 --- a/awx/main/tests/unit/test_tasks.py +++ b/awx/main/tests/unit/test_tasks.py @@ -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')) diff --git a/awx/settings/defaults.py b/awx/settings/defaults.py index f750d336b17a..aa6e0ae4a07d 100644 --- a/awx/settings/defaults.py +++ b/awx/settings/defaults.py @@ -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 = "" diff --git a/awx/ui_next/src/screens/Setting/Jobs/JobsDetail/JobsDetail.test.jsx b/awx/ui_next/src/screens/Setting/Jobs/JobsDetail/JobsDetail.test.jsx index 715bd649e33b..a38edf9c496d 100644 --- a/awx/ui_next/src/screens/Setting/Jobs/JobsDetail/JobsDetail.test.jsx +++ b/awx/ui_next/src/screens/Setting/Jobs/JobsDetail/JobsDetail.test.jsx @@ -55,11 +55,6 @@ describe('', () => { 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'); diff --git a/awx/ui_next/src/screens/Setting/Jobs/JobsEdit/JobsEdit.jsx b/awx/ui_next/src/screens/Setting/Jobs/JobsEdit/JobsEdit.jsx index 3e5d2877276f..13cf86a6b160 100644 --- a/awx/ui_next/src/screens/Setting/Jobs/JobsEdit/JobsEdit.jsx +++ b/awx/ui_next/src/screens/Setting/Jobs/JobsEdit/JobsEdit.jsx @@ -174,10 +174,6 @@ function JobsEdit() { name="AWX_ISOLATED_HOST_KEY_CHECKING" config={jobs.AWX_ISOLATED_HOST_KEY_CHECKING} /> -