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

AsdfFile instances are not pickleable #1782

Open
braingram opened this issue Apr 9, 2024 · 1 comment
Open

AsdfFile instances are not pickleable #1782

braingram opened this issue Apr 9, 2024 · 1 comment

Comments

@braingram
Copy link
Contributor

Description of the problem

AsdfFile instances are not pickleable.

Example of the problem

import asdf, pickle

af = asdf.AsdfFile({'a': 1})
pickle.dumps(af)

Fails with

AttributeError: Can't pickle local object 'ValidatorManager._get_jsonschema_validator.<locals>._validator'

System information

asdf version: main
python version: 3.10
operating system: mac os (m1)

@braingram
Copy link
Contributor Author

To provide a bit more context. The lack of "pickle-ability" means AsdfFile instances do not play well with multiprocessing:

def get_a(af):
    return af['a']

with multiprocessing.Pool(4):
    pool.map(get_a, [af])

Fails with the above error.

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