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

Plugin API: add a update_inputs to plugin's workchain_and_builder #656

Merged
merged 8 commits into from
Apr 16, 2024

Conversation

superstar54
Copy link
Member

@superstar54 superstar54 commented Apr 2, 2024

This PR enhances the plugin API by by introducing a new feature to the workchain_and_builder configuration: the update_inputs method.

This addition addresses limitations in the previous design, where the main workchain rigidly passed only the structure to the plugins' workchains. This approach had notable disadvantages:

  • It mandated that all plugins' workchains accept an input named structure, leading to errors if this was not adhered to. This is the case in the newly developed plugin: aiidalab-qe-hp.
  • It restricted data passed to plugins to be hardcoded, thereby limiting plugin developers' ability to tailor the inputs based on their specific requirements.

The introduction of the update_inputs method provides a dynamic mechanism for updating the inputs of plugins' workchains. It accepts two parameters: inputs and ctx. This method enables developers to customize how the inputs to a plugin's workchain are updated, leveraging the broader context of the Workchain. An immediate benefit of this improvement is observed in the bands and pdos plugins, which can now access current_number_of_bands from the context if available.

Copy link

codecov bot commented Apr 2, 2024

Codecov Report

Attention: Patch coverage is 25.00000% with 12 lines in your changes are missing coverage. Please review.

Project coverage is 75.56%. Comparing base (f63da7d) to head (add20cc).
Report is 54 commits behind head on main.

❗ Current head add20cc differs from pull request most recent head e57e619. Consider uploading reports for the commit e57e619 to get more accurate results

Files Patch % Lines
src/aiidalab_qe/plugins/bands/workchain.py 20.00% 4 Missing ⚠️
src/aiidalab_qe/plugins/pdos/workchain.py 20.00% 4 Missing ⚠️
src/aiidalab_qe/workflows/__init__.py 0.00% 2 Missing ⚠️
src/aiidalab_qe/plugins/xas/workchain.py 50.00% 1 Missing ⚠️
src/aiidalab_qe/plugins/xps/workchain.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #656      +/-   ##
==========================================
- Coverage   80.73%   75.56%   -5.17%     
==========================================
  Files          49       60      +11     
  Lines        3415     4334     +919     
==========================================
+ Hits         2757     3275     +518     
- Misses        658     1059     +401     
Flag Coverage Δ
python-3.10 75.56% <25.00%> (-5.17%) ⬇️
python-3.8 ?
python-3.9 75.59% <25.00%> (-5.18%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@superstar54
Copy link
Member Author

Hi @mikibonacci , this PR has a break change on the plugin's API. You need to update your plugins if this PR gets merged.

@superstar54 superstar54 linked an issue Apr 2, 2024 that may be closed by this pull request
5 tasks
@superstar54 superstar54 mentioned this pull request Apr 2, 2024
@superstar54 superstar54 added this to the v2024.4.0 milestone Apr 2, 2024
Copy link
Contributor

@PNOGillespie PNOGillespie left a comment

Choose a reason for hiding this comment

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

Nice work @superstar54. I've run one test for each basic type of plugin and everything looks fine to me.

I'm interested also to see how this gets built on, since at the moment it's just exposing some inputs, but at least the added functionality is good to have.

@superstar54
Copy link
Member Author

@PNOGillespie Thanks for your review.

@superstar54 superstar54 merged commit 4476651 into aiidalab:main Apr 16, 2024
14 checks passed
@superstar54 superstar54 deleted the plugin/api_add_update_input branch April 16, 2024 14:20
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.

QEapp plugin enhancement
2 participants