aiidateam / aiida-workgraph

Efficiently design and manage flexible workflows with AiiDA, featuring an interactive GUI, checkpoints, provenance tracking, and remote execution capabilities.
https://aiida-workgraph.readthedocs.io/en/latest/
MIT License
9 stars 5 forks source link

Add `PickledFunction` data #229

Closed superstar54 closed 4 weeks ago

superstar54 commented 4 weeks ago

Implement the PickledFunction class as a subclass of orm.Data, the class handles

PythonJob adds function input, which accepts PickledFunction as input.

Docs

Add docs: use the PythonJob task outside the WorkGraph to run a Python function on a remote computer. For example, in a WorkChain or run a single CalcJob calculation.

codecov-commenter commented 4 weeks ago

Codecov Report

Attention: Patch coverage is 76.74419% with 30 lines in your changes missing coverage. Please review.

Project coverage is 79.43%. Comparing base (5937b88) to head (f6e8efb). Report is 33 commits behind head on main.

Files Patch % Lines
aiida_workgraph/orm/function_data.py 85.00% 12 Missing :warning:
aiida_workgraph/orm/general_data.py 52.63% 9 Missing :warning:
aiida_workgraph/calculations/python.py 63.15% 7 Missing :warning:
aiida_workgraph/calculations/python_parser.py 50.00% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #229 +/- ## ========================================== + Coverage 75.75% 79.43% +3.68% ========================================== Files 70 62 -8 Lines 4615 4561 -54 ========================================== + Hits 3496 3623 +127 + Misses 1119 938 -181 ``` | [Flag](https://app.codecov.io/gh/aiidateam/aiida-workgraph/pull/229/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aiidateam) | Coverage Δ | | |---|---|---| | [python-3.11](https://app.codecov.io/gh/aiidateam/aiida-workgraph/pull/229/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aiidateam) | `79.30% <74.41%> (+3.63%)` | :arrow_up: | | [python-3.12](https://app.codecov.io/gh/aiidateam/aiida-workgraph/pull/229/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aiidateam) | `79.32% <74.41%> (?)` | | | [python-3.9](https://app.codecov.io/gh/aiidateam/aiida-workgraph/pull/229/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aiidateam) | `79.36% <76.74%> (+3.63%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aiidateam#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

superstar54 commented 4 weeks ago

Have you tried out or thought about using cloudpickle.register_pickle_by_value of the imported modules so a installation is not necessary on remote machines?

Thanks for pointing out this. I wasn't aware of this before. However, I found that this feature is still experimental and may fail in certain cases. We can add this feature as optional. Maybe in another PR.