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

Formalizing the JobStore document format as a pydantic model #424

Merged
merged 18 commits into from
Oct 11, 2023

Conversation

hrushikesh-s
Copy link
Contributor

Summary

Include a summary of major changes in bullet points:

  • Adding the functionality to parse the JobStore document as a pydantic model in place of dictionary

Checklist

Work-in-progress pull requests are encouraged, but please put [WIP] in the pull request
title.

Before a pull request can be merged, the following items must be checked:

  • Code is in the standard Python style.
    The easiest way to handle this is to run the following in the correct sequence on
    your local machine. Start with running black on your new code. This will
    automatically reformat your code to PEP8 conventions and removes most issues. Then run
    pycodestyle, followed by flake8.
  • Docstrings have been added in theNumpy docstring format.
    Run pydocstyle on your code.
  • Type annotations are highly encouraged. Run mypy to
    type check your code.
  • Tests have been added for any new functionality or bug fixes.
  • All linting and tests pass.

Note that the CI system will run all the above checks. But it will be much more
efficient if you already fix most errors prior to submitting the PR. It is highly
recommended that you use the pre-commit hook provided in the repository. Simply
cp pre-commit .git/hooks and a check will be run prior to allowing commits.

@codecov
Copy link

codecov bot commented Sep 8, 2023

Codecov Report

Merging #424 (f40c16f) into main (6e48ca8) will not change coverage.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #424   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           19        20    +1     
  Lines         1515      1535   +20     
  Branches       415       419    +4     
=========================================
+ Hits          1515      1535   +20     
Files Coverage Δ
src/jobflow/core/job.py 100.00% <100.00%> (ø)
src/jobflow/core/store.py 100.00% <100.00%> (ø)
src/jobflow/schemas/job_output_schema.py 100.00% <100.00%> (ø)

@hrushikesh-s hrushikesh-s changed the title Formalizing the JobStore document format as a pydantic model [WIP] Formalizing the JobStore document format as a pydantic model Sep 8, 2023
@hrushikesh-s hrushikesh-s changed the title [WIP] Formalizing the JobStore document format as a pydantic model Formalizing the JobStore document format as a pydantic model Sep 8, 2023
@hrushikesh-s
Copy link
Contributor Author

hrushikesh-s commented Sep 8, 2023

Hi @utf and @arosen93 ,
@mcgalcode and I tried addressing one of the issues raised in #374

We have come up with some tests to check:

  • If the JobStoreDocument is correctly initialized
  • If the update method from JobStore class is able to insert the Pydantic document into the store

@Andrew-S-Rosen
Copy link
Member

Thanks! Linking this to #422 (as a note to future me) in case Pydantic 2 breaks things later.

@hrushikesh-s
Copy link
Contributor Author

@mkhorton , @mcgalcode : I've implemented the suggestions that were made here in #425

description="The name of the job.",
)

@validator("output", pre=True)
Copy link
Member

@utf utf Sep 28, 2023

Choose a reason for hiding this comment

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

Hi @hrushikesh-s, please can you update this to Pydantic2 syntax, as discussed here: #425 (comment) (if it needs updating, if not, then just give me the go-ahead that I can merge).

@hrushikesh-s
Copy link
Contributor Author

Hi @utf, the JobStoreDocument is now being initialized as a Pydantic v2 document, and the PR is ready to be merged now!

@utf
Copy link
Member

utf commented Oct 11, 2023

Great, thanks for this.

@utf utf merged commit cdbcbd0 into materialsproject:main Oct 11, 2023
9 checks passed
@utf utf added the enhancement New feature or request label Dec 5, 2023
@mkhorton
Copy link
Member

mkhorton commented Jan 8, 2024

Thanks for adding the suggested code @hrushikesh-s! Only just saw this was merged, appreciated your efforts on this :)

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

Successfully merging this pull request may close these issues.

4 participants