-
Notifications
You must be signed in to change notification settings - Fork 54
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
Recipe modules with injectable kws should still be importable (use defaults?) #587
Comments
I actually think the solution is to instead support python 3.10 and up only. dataflow used to require 3.9 but that's not been true for a while. |
We already test 3.10 in this repo, and #567 tests on 3.11 (and the tests pass). And pangeo-forge/pangeo-forge-runner#90 enables us running on all python versions. |
And this is a good motivating reason to drop 3.9 support :) |
Is this something we should be motivated to do? If 3.9 works (and people are used to using it), why drop now just for this feature?
I discovered this is not a workaround. Setting something like: recipe = (
...
| StoreToZarr(
...
target_root="placeholder",
) results in pangeo-forge-runner's rewriter throws
but this issue is avoided by using a default arg; e.g. #588 does work, as tested in pangeo-forge/aqua-modis-feedstock@2ac8ca7, which successfully deployed to Dataflow while replacing the default This makes sense, because it's equivalent to: def something(foo="bar"):
pass
something(foo="baz") which is fine. As opposed to: def something(foo):
pass
something(foo="bar", foo="baz") which is not 😄 . |
The way I think of it, 3.9 is actually holding us back. For example, we can not actually use the most recent version of the pangeo/forge image because it's no longer on 3.9, but on 3.10. And that would bring us newer version of beam, but we can't do that because it's tied to version of 3.10. In all the systems I maintain, the only python 3.9 still present is because of the pangeo/forge pin. Nowhere else. This also actually bit @rsignell-usgs when we were trying to get flink running, as the default python installed in his environment was not actually 3.9. These are all the problems of the pangeo/forge pin ofc rather than supporting 3.9 - but mostly saying that I don't think anyone using this right now wants to use 3.9. Our pangeo/forge pin forces them to, and that's why they are. So I think I would like to frame the question instead as:
|
Separately, that seems to be a bug in the rewriter - if the target argument is already present, I think the rewriter should 'do nothing'. Can you open an issue there? |
Your context for the state of 3.9 use in production is much broader than mine, and this argument is convincing that we should move to drop that. As noted in #588 (comment), #588 is perhaps less concise than it might be with 3.10, but it does fix for this specific issue of importability. What would you say to use merging #588 to close this issue, and also opening a new issue to deprecate 3.9 support, which notes the discussion here insofar as deprecating 3.9 may motivate us to adjust the implementation detail of where #588 defines the default? |
We currently expect recipes to leave certain injectable kws empty, e.g.
StoreToZarr.target_root
, with the understanding thatpangeo-forge-runner
will inject values for these kws at deploy time. (Better documentation of this is forthcoming.)StoreToZarr.target_root
is required, meaning modules leaving it unassigned are not importable, raisingThis is suboptimal for at least two reasons:
pangeo-forge-runner
deployment context. An example (which motivated this opening issue for me) would be to import functions defined in the module for unit testing.I see a few possible fixes:
kw_only
dataclasses to allow theZarrWriterMixin
(from whichStoreToZarr
inheritstarget_root
) to define an inheritable default fortarget_root
. This is my favorite option but its not tractable because this feature is only available in Python 3.10 and not easily back-ported into 3.9.target_root
onZarrWriterMixin
and give all args on its child classes defaults. I don't like this because some of the child class args are required (and therefore should not have defaults).target_root
out ofZarrWriterMixin
and just require that child classes declare this arg themselves. Possibly enforceable via a__post_init__
onZarrWriterMixin
? This means the only value of the mixin is to define theget_forge_target
method, which still seems worthwhile to me.In the meantime, the workaround for this would be to just give a placeholder value to
StoreToZarr.target_root
in the recipe, under the assumption thatpangeo-forge-runner
will still overwrite it. 🤔The text was updated successfully, but these errors were encountered: