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

Add Callback for saving pickled job info #2093

Merged
merged 3 commits into from
Mar 16, 2022

Conversation

jieru-hu
Copy link
Contributor

Add an experimental Callback for pickling job info. Having this as a Callback enables users to opt-in this behavior.

The doc updates will come after all of #1805 is completed.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 14, 2022
@jieru-hu jieru-hu requested review from Jasha10 and pixelb March 14, 2022 23:56
hydra/experimental/pikcle_job_info_callback.py Outdated Show resolved Hide resolved
hydra/experimental/pikcle_job_info_callback.py Outdated Show resolved Hide resolved
hydra/experimental/pikcle_job_info_callback.py Outdated Show resolved Hide resolved
output_dir.mkdir(parents=True, exist_ok=True)
assert output_dir is not None
with open(str(output_dir / filename), "wb") as file:
pickle.dump(obj, file)
Copy link
Contributor

Choose a reason for hiding this comment

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

It's probably better from a compatibility / efficiency standpoint to pick an explicit protocol:
https://docs.python.org/3/library/pickle.html
protocol=4 seems like the most appropriate given our supported python version range

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point, thanks for the link. reading through the doc it seems like there's some extra benefits in setting it to be the highest, so I update it to that. Let me know what you think :)

@jieru-hu jieru-hu requested review from pixelb and Jasha10 March 15, 2022 19:51
hydra/experimental/pickle_job_info_callback.py Outdated Show resolved Hide resolved
@jieru-hu jieru-hu merged commit cb5acbc into facebookresearch:main Mar 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants