Skip to content

Possible fix for issue2294: don't pickle hooks#2295

Merged
bsipocz merged 5 commits into
astropy:mainfrom
keflavich:issue2294
Feb 19, 2022
Merged

Possible fix for issue2294: don't pickle hooks#2295
bsipocz merged 5 commits into
astropy:mainfrom
keflavich:issue2294

Conversation

@keflavich

Copy link
Copy Markdown
Contributor

This PR deletes hooks before pickling.

It fixes #2294 but I haven't checked if it breaks anything else.

@bsipocz @ceb8 thoughts? #2294 is a weird problem.

@codecov

codecov Bot commented Feb 11, 2022

Copy link
Copy Markdown

Codecov Report

Merging #2295 (0d9e641) into main (08e57d7) will decrease coverage by 0.02%.
The diff coverage is 60.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2295      +/-   ##
==========================================
- Coverage   62.75%   62.72%   -0.03%     
==========================================
  Files         130      130              
  Lines       16835    16847      +12     
==========================================
+ Hits        10564    10568       +4     
- Misses       6271     6279       +8     
Impacted Files Coverage Δ
astroquery/query.py 58.72% <60.00%> (+0.02%) ⬆️
astroquery/mast/collections.py 90.25% <0.00%> (-1.85%) ⬇️
astroquery/mast/cloud.py 22.07% <0.00%> (-0.59%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 08e57d7...0d9e641. Read the comment docs.

@ceb8

ceb8 commented Feb 13, 2022

Copy link
Copy Markdown
Member

This, works, but I don't totally understand why. If masked quantities are un-pickleable, why does the deleting the hooks before pickling help?

@keflavich

Copy link
Copy Markdown
Contributor Author

The masked quantities are only present in the hooks. The intent of the caching is to pickle the raw response object from requests, which should have no astroquery-related (or astropy-related) objects associated. The only way astropy/astroquery stuff is getting cached is through the callback hook.

@ceb8

ceb8 commented Feb 14, 2022

Copy link
Copy Markdown
Member

Oh, that makes sense. Then this fix looks great and I don't see why it would break anything else. But definitely @bsipocz should way in before you merge.

@bsipocz bsipocz added this to the v0.4.6 milestone Feb 15, 2022

@bsipocz bsipocz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I wonder why we didn't see this before, did anything change upstream? Also, I wonder whether we could test this?

I don't see any issues with the PR itself, but share the sentiment that this is a weird error and am not sure whether the PR would not break accidentally something. I run the remote test, they don't look more broken than before this PR.

Could you add a changelog entry to the last, infra section though?

@keflavich

Copy link
Copy Markdown
Contributor Author

I think the reason we never saw it before is that it is not very common for astroquery objects to include quantities - this seems to be a thing only for MPC, and only sometimes? And maybe there are only some rare objects that are unpicklable?

I'll add the changelog entry

@bsipocz

bsipocz commented Feb 16, 2022

Copy link
Copy Markdown
Member

And maybe there are only some rare objects that are unpicklable?

yes, maybe it's worth reporting upstream to core.

@bsipocz

bsipocz commented Feb 19, 2022

Copy link
Copy Markdown
Member

Rather than opening a separate issue I did the upstream reporting here, as this seems something very similar: astropy/astropy#12214

@pep8speaks

pep8speaks commented Feb 19, 2022

Copy link
Copy Markdown

Hello @keflavich! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2022-02-19 02:15:43 UTC

@bsipocz bsipocz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I've added a test that fails prior to this PR, and fixed the changelog.

@bsipocz bsipocz merged commit db7f825 into astropy:main Feb 19, 2022
@bsipocz

bsipocz commented Feb 19, 2022

Copy link
Copy Markdown
Member

Thanks @keflavich for the investigation and fix!

@mkelley

mkelley commented Feb 20, 2022

Copy link
Copy Markdown
Contributor

Thanks, @keflavich !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Problem with MPC.get_observations

5 participants