(optionally) include location info in LoggedException log message#165
(optionally) include location info in LoggedException log message#165stdweird merged 8 commits intohpcugent:masterfrom
Conversation
|
@stdweird: please review |
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
There was a problem hiding this comment.
EasyBuildError -> LoggedException
|
@stdweird: remarks fixed or replied to, please rereview |
|
Refer to this link for build results (access rights to CI server needed): |
There was a problem hiding this comment.
see previous remarks: relpath can't have a os.path.sep, so this is always false
There was a problem hiding this comment.
copy-pasting from reply to remark, which is hidden due to the updates:
no, it's not always false, since relpath is updated via os.path.join in the body of the while loop
I'm using the os.path.sep as an 'end of name' marker to make sure I don't have a partial match, e.g.:
'easybuild/tools/filetools.py'.startswith('easybuild/') == True
'easybuild-framework/easybuild/tools/filetools.py'.startswith('easybuild/') == FalseWhat I'm doing here is trimming something like /home/kehoste/easybuild-framework/easybuild/tools/filetools.py down to just easybuild/tools/filetools.py
I agree this looks rather strange, but I haven't found a better to do this.
path_parts is a list like ['', 'home', 'kehoste', 'easybuild-framework', 'easybuild', 'tools', 'filetools.py'], so I'm taking the end of the list until I have something that starts with easybuid/ (or vsc/)
There was a problem hiding this comment.
so it's like
path_parts = frameinfo[1].split(os.path.sep)
shortest = max([path_parts.index(n) for n in self.LOC_INFO_TOP_PKG_NAMES if n in path_parts])
relpath = os.path.join(path_parts[max:])
(and deal with empty list in max etc etc)
|
Refer to this link for build results (access rights to CI server needed): |
|
@stdweird: remark fixed, please rereview |
|
Refer to this link for build results (access rights to CI server needed): |
There was a problem hiding this comment.
replace if/else with
relpath = os.path.join(*path_parts[max(top_indices or [0]):])(or + instead of or; it doesn't really matter)
|
Refer to this link for build results (access rights to CI server needed): |
(optionally) include location info in LoggedException log message
ported from easybuilders/easybuild-framework#1249