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

Allows to workgraph/pythonjob to directly pickle an imported function/pythonjob #398

Open
mikibonacci opened this issue Feb 3, 2025 · 0 comments

Comments

@mikibonacci
Copy link
Contributor

mikibonacci commented Feb 3, 2025

If I am in package A and I defined a python function or PythonJob in a file, then I define a WorkGraph which imports it, as follows:

from aiida_workgraph import WorkGraph

from A import compute_KT

...

wg = WorkGraph()
task = wg.add_task(
        "PythonJob",
        function=compute_KT,
        structure=structure,
        name="KuboToyabe_run",
        code = code,
        metadata=metadata,
        deserializers={
            "aiida.orm.nodes.data.structure.StructureData": "aiida_pythonjob.data.deserializer.structure_data_to_atoms"
        },
        serializers={
            "ase.atoms.Atoms": "aiida_pythonjob.data.serializer.atoms_to_structure_data"
        },
    )

This, on remote, will not pickle the compute_KT function, but it will try to import from module A, which actually should not be installed on the remote (maybe is my aiida-plugin package).

As suggested by @superstar54 , we can put the choice to pickle a function or not.

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

No branches or pull requests

1 participant