Skip to content

Commit

Permalink
pylint, flake8, rpmlint so so picky
Browse files Browse the repository at this point in the history
Signed-off-by: Kenneth Cain <[email protected]>
  • Loading branch information
kccain committed Dec 20, 2024
1 parent 8b08d98 commit 14ae197
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
21 changes: 11 additions & 10 deletions src/tests/ftest/cart/util/daos_sys_logscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import cart_logparse


class SysPools():
"""Directory of Pools and Summary Activities Found in Engine Log Files"""

Expand Down Expand Up @@ -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?
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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():

Check warning on line 447 in src/tests/ftest/cart/util/daos_sys_logscan.py

View workflow job for this annotation

GitHub Actions / Pylint check

consider-using-dict-items, Consider iterating with .items()

Check warning on line 447 in src/tests/ftest/cart/util/daos_sys_logscan.py

View workflow job for this annotation

GitHub Actions / Pylint check

consider-iterating-dictionary, Consider iterating the dictionary directly instead of calling .keys()
print(f"===== Pool {puuid}:")
for term in self._pools[puuid]:
b = self._pools[puuid][term]["begin_time"]
Expand Down Expand Up @@ -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():

Check warning on line 502 in src/tests/ftest/cart/util/daos_sys_logscan.py

View workflow job for this annotation

GitHub Actions / Pylint check

consider-using-dict-items, Consider iterating with .items()

Check warning on line 502 in src/tests/ftest/cart/util/daos_sys_logscan.py

View workflow job for this annotation

GitHub Actions / Pylint check

consider-iterating-dictionary, Consider iterating the dictionary directly instead of calling .keys()
tmp = dict(sorted(self._pools[puuid].items()))
self._pools[puuid] = tmp
# _pools[puuid][term]["maps"] should have been inserted in ascending order already?
Expand Down
2 changes: 1 addition & 1 deletion utils/rpms/daos.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit 14ae197

Please sign in to comment.