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 ability to specify callbacks to run after each client request #1519

Merged
merged 2 commits into from Feb 20, 2023

Conversation

ml-evs
Copy link
Member

@ml-evs ml-evs commented Feb 18, 2023

This PR adds callbacks to the client, callable functions that will be execute with the results from each query as they come in. This can be useful for constructing secondary databases, saving to files etc.

@codecov
Copy link

codecov bot commented Feb 19, 2023

Codecov Report

Merging #1519 (670c7a5) into master (c87d6c3) will decrease coverage by 0.01%.
The diff coverage is 92.30%.

@@            Coverage Diff             @@
##           master    #1519      +/-   ##
==========================================
- Coverage   91.10%   91.10%   -0.01%     
==========================================
  Files          74       74              
  Lines        4507     4518      +11     
==========================================
+ Hits         4106     4116      +10     
- Misses        401      402       +1     
Flag Coverage Δ
project 91.10% <92.30%> (-0.01%) ⬇️
validator 90.99% <92.30%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
optimade/client/client.py 82.00% <92.30%> (+0.33%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@ml-evs ml-evs added enhancement New feature or request client Issues/PRs relating to the OPTIMADE client. labels Feb 19, 2023
Copy link
Contributor

@JPBergsma JPBergsma left a comment

Choose a reason for hiding this comment

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

LGTM

@ml-evs
Copy link
Member Author

ml-evs commented Feb 20, 2023

Thanks @JPBergsma -- I want to write some examples into the docs at some point but not sure when I will get time.

I'm going to make a 0.21 release now ahead of the tutorials next week.

@ml-evs ml-evs merged commit 8a19957 into master Feb 20, 2023
@ml-evs ml-evs deleted the ml-evs/client_callbacks branch February 20, 2023 18:33
@ml-evs ml-evs linked an issue Feb 20, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client Issues/PRs relating to the OPTIMADE client. enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add customisable callback functions to client
2 participants