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

feat: meld LineInterface into BaseModel #20

Merged
merged 1 commit into from
Sep 20, 2024

Conversation

NucciTheBoss
Copy link
Member

This PR refactors how the models are parsed and marshalled to and from their respective configuration file formats (string) into a data model that Python can understand.

The TL;DR is that now, if you want a data model in its configuration file format, all you have to do is just call str:

str(some_slurm_data_model)

If you want to construct a data model from a string, you can use the alternative constructor from_str:

SlurmConfig.from_str("<slurm configuration data>")

This removes the need for the intermediary _parse and _marshall functions that were defined as part of each editor.

Signed-off-by: Jason C. Nucciarone <[email protected]>
@NucciTheBoss NucciTheBoss added the Type: Enhancement Proposes a new feature to be added to the project. label Sep 19, 2024
Copy link
Contributor

@jedel1043 jedel1043 left a comment

Choose a reason for hiding this comment

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

Really liking the new structure! I think it's a lot better to have the parsing methods available directly on the models, since it could enable interesting abstractions around that.

@NucciTheBoss
Copy link
Member Author

Really liking the new structure! I think it's a lot better to have the parsing methods available directly on the models, since it could enable interesting abstractions around that.

I agree with that! It'll be nice to have a similar API to the json and yaml modules with the load, loads, dump, and dumps methods, but also still be able to enable developers to write their own abstractions around the Slurm data models.

@NucciTheBoss
Copy link
Member Author

Going to open follow up PR with the vbump and updates to the README

@NucciTheBoss NucciTheBoss merged commit b4b9613 into charmed-hpc:main Sep 20, 2024
3 checks passed
@NucciTheBoss NucciTheBoss deleted the feat-to-str branch October 7, 2024 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Proposes a new feature to be added to the project.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants