From 14ae197735b2e166d793e43dff4a4cf3749982d7 Mon Sep 17 00:00:00 2001 From: Kenneth Cain Date: Fri, 20 Dec 2024 16:22:23 -0500 Subject: [PATCH] pylint, flake8, rpmlint so so picky Signed-off-by: Kenneth Cain --- src/tests/ftest/cart/util/daos_sys_logscan.py | 21 ++++++++++--------- utils/rpms/daos.spec | 2 +- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/tests/ftest/cart/util/daos_sys_logscan.py b/src/tests/ftest/cart/util/daos_sys_logscan.py index 1734d5578d6..554113c77ca 100755 --- a/src/tests/ftest/cart/util/daos_sys_logscan.py +++ b/src/tests/ftest/cart/util/daos_sys_logscan.py @@ -12,6 +12,7 @@ import cart_logparse + class SysPools(): """Directory of Pools and Summary Activities Found in Engine Log Files""" @@ -107,7 +108,7 @@ def _find_rank(self, log_iter): return found # return log-message, hostname, and date/timestamp components of the line - def get_line_components(self, line): + def _get_line_components(self, line): return line.get_msg(), line.hostname, line.time_stamp # is this rank, pid the leader of the pool with uuid puuid? @@ -119,7 +120,7 @@ def _is_leader(self, puuid, rank, pid): return False def _match_ps_step_up(self, fname, line, pid, rank): - msg, host, datetime = self.get_line_components(line) + msg, host, datetime = self._get_line_components(line) match = self.re_step_up.match(msg) if match: puuid = match.group(1) @@ -158,7 +159,7 @@ def _match_ps_step_up(self, fname, line, pid, rank): return False def _match_ps_step_down(self, fname, line, pid, rank): - msg, host, datetime = self.get_line_components(line) + msg, host, datetime = self._get_line_components(line) match = self.re_step_down.match(msg) if match: puuid = match.group(1) @@ -176,7 +177,7 @@ def _match_ps_step_down(self, fname, line, pid, rank): return False def _match_ps_pmap_update(self, fname, line, pid, rank): - msg, host, datetime = self.get_line_components(line) + msg, host, datetime = self._get_line_components(line) match = self.re_pmap_update.match(msg) if match: puuid = match.group(1) @@ -205,7 +206,7 @@ def _match_ps_rb_start(self, fname, line, pid, rank): # Do not match on new rebuild log format if we found legacy format if not self._check_rb_new_fmt: return False - msg, host, datetime = self.get_line_components(line) + msg, host, datetime = self._get_line_components(line) match = self.re_rebuild_ldr_start.match(msg) if match: # Disable checking for legacy rebuild log format, to save execution time @@ -241,7 +242,7 @@ def _match_legacy_ps_rb_start(self, fname, line, pid, rank): # Do not match on legacy rebuild log format if we found new format if not self._check_rb_legacy_fmt: return False - msg, host, datetime = self.get_line_components(line) + msg, host, datetime = self._get_line_components(line) match = self.re_old_ldr_start.match(msg) if match: # Disable checking for new rebuild log format, to save execution time @@ -279,7 +280,7 @@ def _match_ps_rb_status(self, fname, line, pid, rank): # Do not match on new rebuild log format if we found legacy format if not self._check_rb_new_fmt: return False - msg, host, datetime = self.get_line_components(line) + msg, host, datetime = self._get_line_components(line) match = self.re_rebuild_ldr_status.match(msg) if match: # Disable checking for legacy rebuild log format, to save execution time @@ -337,7 +338,7 @@ def _match_legacy_ps_rb_status(self, fname, line, pid, rank): # Do not match on legacy rebuild log format if we found new format if not self._check_rb_legacy_fmt: return False - msg, host, datetime = self.get_line_components(line) + msg, host, datetime = self._get_line_components(line) match = self.re_old_ldr_status.match(msg) if match: # Disable checking for new rebuild log format, to save execution time @@ -443,7 +444,7 @@ def scan_file(self, log_iter, rank=-1): def print_pools(self): """Print all pools important events found in a nested dictionary""" - for puuid in self._pools: + for puuid in self._pools.keys(): print(f"===== Pool {puuid}:") for term in self._pools[puuid]: b = self._pools[puuid][term]["begin_time"] @@ -498,7 +499,7 @@ def print_pools(self): def sort(self): """Sort the nested dictionary of pools by pool service term""" - for puuid in self._pools: + for puuid in self._pools.keys(): tmp = dict(sorted(self._pools[puuid].items())) self._pools[puuid] = tmp # _pools[puuid][term]["maps"] should have been inserted in ascending order already? diff --git a/utils/rpms/daos.spec b/utils/rpms/daos.spec index e9de33b41c7..ec27450f471 100644 --- a/utils/rpms/daos.spec +++ b/utils/rpms/daos.spec @@ -366,7 +366,7 @@ install -m 644 utils/systemd/%{agent_svc_name} %{buildroot}/%{_unitdir} mkdir -p %{buildroot}/%{conf_dir}/certs/clients mv %{buildroot}/%{conf_dir}/bash_completion.d %{buildroot}/%{_sysconfdir} # fixup env-script-interpreters -sed -i -e '1s/env //' %{buildroot}{%{daoshome}/TESTING/ftest/{cart/cart_logtest,config_file_gen,launch,slurm_setup,tags,verify_perms}.py,%{_bindir}/daos_storage_estimator.py} +sed -i -e '1s/env //' %{buildroot}{%{daoshome}/TESTING/ftest/{cart/cart_logtest,cart/daos_sys_logscan,config_file_gen,launch,slurm_setup,tags,verify_perms}.py,%{_bindir}/daos_storage_estimator.py} # shouldn't have source files in a non-devel RPM rm -f %{buildroot}%{daoshome}/TESTING/ftest/cart/{test_linkage.cpp,utest_{hlc,portnumber,protocol,swim}.c,wrap_cmocka.h}