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

Add "created-on" in config history #491

Merged
merged 5 commits into from
Mar 16, 2023
Merged

Conversation

gabegma
Copy link
Contributor

@gabegma gabegma commented Mar 15, 2023

Description:

See commit messages.

Checklist:

You should check all boxes before the PR is ready. If a box does not apply, check it to acknowledge it.

  • ISSUE NUMBER. You linked the issue number (Ex: Resolve #XXX).
  • PRE-COMMIT. You ran pre-commit on all commits, or else, you
    ran pre-commit run --all-files at the end.
  • USER CHANGES. The changes are added to CHANGELOG.md and the documentation, if they impact
    our users.
  • DEV CHANGES.
    • Update the documentation if this PR changes how to develop/launch on the app.
    • Update the README files and our wiki for any big design decisions, if relevant.
    • Add unit tests, docstrings, typing and comments for complex sections.

azimuth/config.py Outdated Show resolved Hide resolved
@gabegma gabegma changed the title Add meta data in config history Add "created-on" in config history Mar 15, 2023
@gabegma gabegma force-pushed the ggm/add-meta-data-in-config-history branch 2 times, most recently from 87f8909 to 5e4a2c0 Compare March 15, 2023 20:35
@gabegma gabegma force-pushed the ggm/add-meta-data-in-config-history branch from 5e4a2c0 to 4ecbdea Compare March 15, 2023 21:01
@gabegma gabegma marked this pull request as ready for review March 15, 2023 21:01
@@ -461,7 +461,8 @@ def load_azimuth_config(config_path: Optional[str], load_config_history: bool) -
config_history_path = cfg.get_config_history_path()
try:
with jsonlines.open(config_history_path, mode="r") as config_history:
*_, last_config = config_history
*_, last_config_info = config_history
last_config = last_config_info["config"]
Copy link
Contributor

Choose a reason for hiding this comment

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

If the JSON was malformed, that would raise a KeyError. I don't know if we want that. If we want to let pydantic parse the JSON and produce the "clear" errors, we can create a class like AzimuthConfigHistory. I gave it a try in #493. It also has the advantage of defining how to create the datetime string inside the definition of AzimuthConfigHistory, thanks to default_factory. I don't know what approach is best. What do you think?

Copy link
Contributor

@JosephMarinier JosephMarinier left a comment

Choose a reason for hiding this comment

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

Cool! Thank you! 👍

@gabegma gabegma enabled auto-merge March 16, 2023 18:03
@gabegma gabegma merged commit c86b302 into main Mar 16, 2023
@gabegma gabegma deleted the ggm/add-meta-data-in-config-history branch March 16, 2023 18:16
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