Skip to content

Add traceback in serializer#20

Merged
superstar54 merged 4 commits intomainfrom
calcfunction_auto_serialize
Mar 23, 2025
Merged

Add traceback in serializer#20
superstar54 merged 4 commits intomainfrom
calcfunction_auto_serialize

Conversation

@superstar54
Copy link
Member

@superstar54 superstar54 commented Mar 22, 2025

  • Add PyFunction process and @pyfunction decorator for running pure Python functions locally within AiiDA.
  • Automatically serializes inputs and deserializes outputs, enabling use of native Python types.

Here is an example:

from aiida.engine import run_get_node
from aiida_pythonjob.decorator import pyfunction
from aiida import load_profile
from ase.build import bulk

load_profile()

@pyfunction(outputs=[{"name": "supercell"}, {"name": "original"}])
def make_supercell(atoms, dims=[2, 2, 2]):
    return {"supercell": atoms*dims, "original": atoms}

atoms = bulk('Si')
result, node = run_get_node(make_supercell, atoms=atoms, dims=[2, 2, 2])
print("result: ", result)

@codecov-commenter
Copy link

codecov-commenter commented Mar 22, 2025

Codecov Report

Attention: Patch coverage is 77.22008% with 59 lines in your changes missing coverage. Please review.

Project coverage is 85.32%. Comparing base (71a2315) to head (5c503dc).

Files with missing lines Patch % Lines
src/aiida_pythonjob/calculations/pyfunction.py 76.66% 35 Missing ⚠️
src/aiida_pythonjob/decorator.py 81.25% 12 Missing ⚠️
src/aiida_pythonjob/launch.py 75.00% 9 Missing ⚠️
src/aiida_pythonjob/data/serializer.py 62.50% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #20      +/-   ##
==========================================
- Coverage   88.04%   85.32%   -2.73%     
==========================================
  Files          14       16       +2     
  Lines         661      913     +252     
==========================================
+ Hits          582      779     +197     
- Misses         79      134      +55     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@superstar54 superstar54 force-pushed the calcfunction_auto_serialize branch 2 times, most recently from fb3892f to f89dcca Compare March 23, 2025 22:13
@superstar54 superstar54 force-pushed the calcfunction_auto_serialize branch from f89dcca to e0c7a87 Compare March 23, 2025 22:16
@superstar54 superstar54 merged commit d8f44f7 into main Mar 23, 2025
5 checks passed
@superstar54 superstar54 deleted the calcfunction_auto_serialize branch March 23, 2025 22:45
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