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
Refactoring parsers #22
Conversation
Added temporary tests asserting against current parser outputs from log files in the data directory
Separate parsing components for norel and nodelog sections. Replace main code sections with the new parsers.
Use common interface and helper functions
Update tox config and package data specs
Move loaders for parameter defaults and descriptions to dedicated grblogtools.parameters package
merged_logs argument is not needed, we always collect multiple logs from a file and use a LogNumber column to distinguish them
Avoid trying to create Log/ModelFile/Model columns when ModelFilePath is not available.
Co-authored-by: Maliheh Aramon <maliheha@users.noreply.github.com>
@mattmilten we are pretty close to done with refactoring in this PR :) There are some very minor behaviour changes which we've documented in the changelog. To try to avoid regressions, the previous code is still in the repo, and When you have a chance to review could you let us know your thoughts? Probably a few things could still be tidied up but we're quite happy with the structure. Thanks @maliheha for your great work on this so far, and for putting the below summary of the new structure:
|
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.
Excellent work! One question: would it make sense to define a base class for the different parsers? They all implement the same function anyway but the classes do not seem to be connected by a common base class.
Thanks! I don't think abstract base classes really add much here. There's a common API between classes but the abstract class doesn't add any functionality, so I'm inclined to just leave it as is. |
Click 8.1.0 broke something in the black formatter. Temporarily fix to <= 8.0.4
Update author list and bump version
Remove -m (merged logs) option from cli. Update cli to use new API. Run api tests against top level import.
Termination regexes could return None values, which then failed in type conversion.
has seen a proper log start line.""" | ||
|
||
parser = HeaderParser() | ||
parse_lines(parser, ["Presolved: 390 rows, 316 columns, 1803 nonzeros"]) |
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.
I have seen this to happen in the dev log when we have node presolve output too. If I am not overlooking, in a typical log, the header parser should not interrupt because we should have been in the presolve parser when reaching this line. That being said, thank you for the change. It is definitely safer to guard against some patterns.
@mattmilten this is ready to go! |
@maliheha and I are working on this on my fork. These updates aims to separate the parsers for different sections of the log into submodules so things are easier to unit-test and modify as we go.
@mattmilten no need to review for now, we'll let you know when it's in a more complete state.
@ronaldvdv we noticed you're also adding some tests and example data - can we fold this into the refactored code? Just want to make sure we aren't duplicating work and writing tests that may eventually clash with one another. Happy to discuss and coordinate together.