-
Notifications
You must be signed in to change notification settings - Fork 302
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
DAOS-16111 test: new utility daos_sys_logscan #15629
base: master
Are you sure you want to change the base?
Conversation
Scan a list of engine logfiles to produce a nested dictionary of pools and a sequence of key events such as pool leadership terms, pool map version updates (due to target state changes), rebuild start and progress update events and total rebuild duration. This first version focuses on finding the pool service leader engine log file and producing this information. Future updates to the tool can potentially include finer-grain tracking of operations across all pool storage engine log files. The supporting class LogLine in cart_logparse.py has a tiny change to support this new utility. Signed-off-by: Kenneth Cain <[email protected]>
Ticket title is 'rebuild enhancement: uniform identifier in log messages' |
Test stage Build RPM on Leap 15.5 completed with status UNSTABLE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-15629/1/execution/node/327/log |
Test stage Build RPM on EL 9 completed with status UNSTABLE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-15629/1/execution/node/437/log |
Test stage Build RPM on EL 8 completed with status UNSTABLE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-15629/1/execution/node/432/log |
Test stage Build DEB on Ubuntu 20.04 completed with status UNSTABLE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-15629/1/execution/node/431/log |
# rebuild aborted/errored | ||
# rebuild completed/success | ||
|
||
re_rank_assign = re.compile("ds_mgmt_drpc_set_rank.*set rank to (\d+)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
W605 invalid escape sequence
usually resolved by using a regex string
re_rank_assign = re.compile("ds_mgmt_drpc_set_rank.*set rank to (\d+)") | |
re_rank_assign = re.compile(r"ds_mgmt_drpc_set_rank.*set rank to (\d+)") |
rank = -1 | ||
for line in log_iter.new_iter(pid=pid): | ||
msg = line.get_msg() | ||
host = line.hostname | ||
datetime = line.time_stamp | ||
# Find engine rank assignment (early in log) | ||
match = self.re_rank_assign.match(msg) | ||
if match: | ||
rank = int(match.group(1)) | ||
print(f"========== rank {rank} logfile {fname} ==========") | ||
continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if rank == -1
at the end of this loop?
match = self.re_pmap_update.match(msg) | ||
if match: | ||
puuid = match.group(1) | ||
from_ver = int(match.group(2)) | ||
to_ver = int(match.group(3)) | ||
# ignore if this engine is not the leader | ||
if puuid not in self._pools or rank != self._cur_ldr_rank[puuid]: | ||
continue | ||
term = self._cur_term[puuid] | ||
self._pools[puuid][term]["maps"][to_ver] = {"carryover": False, "from_ver": from_ver, "time": datetime, "rebuild_gens": {}} | ||
#print(f"FOUND pool {puuid} map update {from_ver}->{to_ver} rank {rank}\t{host}\tPID {pid}\t{fname}") | ||
continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function has a lot of these of the format
match = ...
if match:
...
I think it would be easier to manage if each was a helper function. Then this function could either loop over each one, or call out to each function. It's generally not pythonic to have large functions.
There are many ways to do this, but some general examples might be (depending on what you need)
def fun1(arg):
print(arg)
def fun2(arg):
print(arg)
all_funs = (fun1, fun2)
for _fun in all_funs:
_fun('test')
def fun1(arg1, arg2):
print(arg1, arg2)
def fun2(arg1, arg2):
print(arg1, arg2)
all_funs_args = (
(fun1, ('arg1', 'arg2')),
(fun2, ('arg1', 'arg2')))
for _fun, args in all_funs_args:
_fun(*args)
continue | ||
term = self._cur_term[puuid] | ||
if term < 1: | ||
print(f"WARN pool {puuid} I don't know what term it is ({term})!") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depending on what tracks overall failure, might want to store warnings and errors somewhere instead of simply printing. Roughly e.g.
def _warn(self, message):
print(f"WARN: {message}")
self._warnings.append(message) # if you want to store the message
self._warnings +=1 # if you just want a count
And then later can do
if self._warnings:
print("Whoah something bad!")
sys.exit(1) # or return 1, etc.
Signed-off-by: Kenneth Cain <[email protected]>
Test stage Build RPM on Leap 15.5 completed with status UNSTABLE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-15629/2/execution/node/361/log |
Test stage Build RPM on EL 9 completed with status UNSTABLE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-15629/2/execution/node/368/log |
Test stage Build RPM on EL 8 completed with status UNSTABLE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-15629/2/execution/node/367/log |
Test stage Build DEB on Ubuntu 20.04 completed with status UNSTABLE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-15629/2/execution/node/349/log |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small suggested fixes.
def _warn(self, wmsg, fname, line): | ||
full_msg = f"WARN file={fname}, line={line.lineno}: " + wmsg | ||
self._warnings.append(full_msg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def _warn(self, wmsg, fname, line): | |
full_msg = f"WARN file={fname}, line={line.lineno}: " + wmsg | |
self._warnings.append(full_msg) | |
def _warn(self, wmsg, fname, line=None): | |
full_msg = f"WARN file={fname}" | |
if line: | |
full_msg += f", line={line.lineno}" | |
full_msg += f": {wmsg}" | |
self._warnings.append(full_msg) |
# Find rank assignment log line for this file. Can't do much without it. | ||
self._file_to_rank[fname] = rank | ||
if rank == -1 and not self.find_rank(log_iter): | ||
self._warn(f"cannot find rank assignment in log file - skipping", fname, line) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self._warn(f"cannot find rank assignment in log file - skipping", fname, line) | |
self._warn("cannot find rank assignment in log file - skipping", fname) |
- fix up some flake8 python linting issues Signed-off-by: Kenneth Cain <[email protected]>
Test stage Build RPM on EL 9 completed with status UNSTABLE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-15629/3/execution/node/356/log |
Test stage Build RPM on Leap 15.5 completed with status UNSTABLE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-15629/3/execution/node/357/log |
Test stage Build RPM on EL 8 completed with status UNSTABLE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-15629/3/execution/node/351/log |
Test stage Build DEB on Ubuntu 20.04 completed with status UNSTABLE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-15629/3/execution/node/345/log |
Signed-off-by: Kenneth Cain <[email protected]>
Test stage Build RPM on EL 9 completed with status UNSTABLE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-15629/4/execution/node/357/log |
Test stage Build RPM on Leap 15.5 completed with status UNSTABLE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-15629/4/execution/node/358/log |
Test stage Build RPM on EL 8 completed with status UNSTABLE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-15629/4/execution/node/352/log |
Test stage Build DEB on Ubuntu 20.04 completed with status UNSTABLE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-15629/4/execution/node/338/log |
Scan a list of engine logfiles to produce a nested dictionary of pools and a sequence of key events such as pool leadership terms, pool map version updates (due to target state changes), rebuild start and progress update events and total rebuild duration. This first version focuses on finding the pool service leader engine log file and producing this information. Future updates to the tool can potentially include finer-grain tracking of operations across all pool storage engine log files.
The supporting class LogLine in cart_logparse.py has a tiny change to support this new utility.
Before requesting gatekeeper:
Features:
(orTest-tag*
) commit pragma was used or there is a reason documented that there are no appropriate tags for this PR.Gatekeeper: