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

Change default callback_filter in update_metadata #721

Merged
merged 2 commits into from
Dec 18, 2024

Conversation

esoteric-ephemera
Copy link
Contributor

Changing the default value of callback_filter in the update_metadata function of both Job and Flow from a lambda to None. Having its default value be a lamdba function means that it cannot be round-trip de-/serialized:

from monty.json import MontyEncoder, MontyDecoder

f = lambda _ : True
encoded = MontyEncoder().encode(f)
print(encoded)
>>> '{"@module": "__main__", "@callable": "<lambda>", "@bound": null}'
decoded = MontyDecoder().decode(encoded)
print(decoded)
>>> {'@module': '__main__', '@callable': '<lambda>', '@bound': None}

This causes issues in fireworks with the newest release of jobflow. Linking relevant discussion here and tagging @janosh and @utf for thoughts

Because lambda's aren't pickle-able without something like dill, writing a callback_filter as an importable function might be the only option for fireworks / jobflow users

Copy link
Member

@janosh janosh left a comment

Choose a reason for hiding this comment

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

Looks good 👍 thank you for fixing!

Copy link
Member

@utf utf left a comment

Choose a reason for hiding this comment

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

@utf utf merged commit ba0db5a into materialsproject:main Dec 18, 2024
7 checks passed
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.

3 participants