Skip to content

Conversation

@Flamefire
Copy link
Contributor

In preparation for easybuilders/easybuild-easyblocks#157 I created this PoC.

The specification is (as documented):

    Check logTxt for messages matching regExps in order and do appropriate action
    :param logTxt: String containing the log, will be split into individual lines
    :param regExps: List of: regular expressions (as RE or string) to error on,
                    or tuple of regular expression and action (any of [IGNORE, WARN, ERROR])

In the end you'll get (if appropriate) a logged warning and an exception about the found issues.

I guess this function could even be split: 1 that returns the (warnings, errors) tuple and one that also increases errors_found_in_log, logs the warning and raises the exception (which would be the most common usage), but the name parse_log_for_error is already taken. Maybe name it parse_log_for_errors? The "old" parse_log_for_error can be implemented in terms of that but in can probably be simply deprecated. It is strange, does to much and yet almost nothing. Similar for parse_cmd_output. So for backwards compatibility I'd rather have EasyBlocks call check_log_for_errors directly and pass None as the regExp to run_cmd*

Copy link
Member

@boegel boegel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Flamefire I squeezed in some minor fixes via 0859617, with that in place this is good to go in imho.

I'll go ahead and merge this to be included in the upcoming EasyBuild v4.1.1...

@boegel boegel merged commit 5a0cf13 into easybuilders:develop Jan 14, 2020
@Flamefire Flamefire deleted the build_errors branch January 15, 2020 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants