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(db): Add command_meta and settings from argparser as json #370

Merged
merged 2 commits into from
Feb 24, 2023

Conversation

peckto
Copy link
Contributor

@peckto peckto commented Feb 24, 2023

This PR adds two columns to the run_meta db table:

  1. command_meta: same as the one in META.json
  2. settings: key -> value pair of settings retrieved from the argparser

For settings from the argparser, only the follwing trivial types are currently supported: str, int, float.
Other, complex data types would need a custom json serializer, which is out of scope for now.
Unsupported data types are skipped to prevent any confusion.

The DB schema version is increased to 2.0

@@ -27,7 +27,7 @@ def bytes_repr(data: bytes) -> str:
return bytes_repr_(data, False, None)


schema_version = "1.0"
schema_version = "1.1"
Copy link
Member

Choose a reason for hiding this comment

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

Let's use schema 2. Major/Minor schemas do not make sense IMO.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

def dump_args(args: Namespace) -> dict[str, str | int | float]:
settings = {}
for key, value in args.__dict__.items():
if isinstance(value, str):
Copy link
Member

Choose a reason for hiding this comment

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

use match

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks, fixed

@peckto peckto force-pushed the db-meta-command branch 3 times, most recently from 65776f4 to 6e752d0 Compare February 24, 2023 12:33
@rumpelsepp rumpelsepp merged commit 1a118bb into master Feb 24, 2023
@rumpelsepp rumpelsepp deleted the db-meta-command branch February 24, 2023 13:50
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