Skip to content
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

Allow calling parser without reading/writing files #94

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

FlorianPommerening
Copy link
Member

This is something that came up yesterday when working on the PDDL minimizer. We would like to import the parser class from lab and use it to parse the output of a run of Fast Downward but we would like to avoid writing files. Currently, we write the log to the disk, call the parser, read the properties from the disk and then delete log and properties. In this patch, loading the logs and writing the properties is decoupled from parsing. This is a bit tricky because of the _FileParser class but I think I found a way. If you are not too attached to the _FileParser class, there may be an easier way that modifies it a bit: instead of storing the content in it, we only store the filename and pass the file_contents dictionary to the function that actually does the parsing.

@jendrikseipp
Copy link
Collaborator

I think that being able to parse in-memory text is a pretty specialized requirement and I'm hesitant to add this to the Lab API. Couldn't you simply copy the Parser class to your project and adapt it to your needs there?

@FlorianPommerening
Copy link
Member Author

We could do that but using lab as a third-party library would be more useful because people could take the parsers they wrote for their experiment and use them in the minimizer without re-implementing them. in general, I think the view of lab "as a library" instead of "as a framework" fits better with functions that do things in memory rather than code that expects a specific file layout.

I also think the change in this patch is good in general because it takes a function that does many things and replaces it by several functions that each do a single thing.

@jendrikseipp
Copy link
Collaborator

Sorry that this is lingering for so long already, but it will have to linger a while longer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants