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

Fix issue with lazy_import affecting pulumi-eks #7024

Merged
merged 6 commits into from
May 12, 2021

Conversation

t0yv0
Copy link
Member

@t0yv0 t0yv0 commented May 11, 2021

Fixes #7021

@t0yv0 t0yv0 requested review from justinvp, lblackstone and komalali and removed request for lblackstone May 11, 2021 19:24
@github-actions
Copy link

Diff for pulumi-random with merge commit f0ace54

@github-actions
Copy link

Diff for pulumi-azuread with merge commit f0ace54

@github-actions
Copy link

Diff for pulumi-kubernetes with merge commit f0ace54

@github-actions
Copy link

Diff for pulumi-gcp with merge commit f0ace54

@github-actions
Copy link

Diff for pulumi-azure with merge commit f0ace54

@github-actions
Copy link

Diff for pulumi-aws with merge commit f0ace54

@github-actions
Copy link

Diff for pulumi-azure-native with merge commit f0ace54

@t0yv0
Copy link
Member Author

t0yv0 commented May 11, 2021

One aspect tis code is moving from codegen into shared lib in pulumi Python SDK. Will this create problems (non-atomic releases)? IF this can create problems I can compensate by temporary code that, failing to find the function in Pulumi SDK defaults to an inline implementation.

@t0yv0 t0yv0 requested a review from stack72 May 11, 2021 20:54
@github-actions
Copy link

Diff for pulumi-random with merge commit 099ef4f

@github-actions
Copy link

Diff for pulumi-azuread with merge commit 099ef4f

@t0yv0 t0yv0 changed the title Fix issue with lazy_import in presense of modules-as-attrs Fix issue with lazy_import affecting pulumi-eks May 11, 2021
@github-actions
Copy link

Diff for pulumi-kubernetes with merge commit 099ef4f

@github-actions
Copy link

Diff for pulumi-random with merge commit 26b6031

@github-actions
Copy link

Diff for pulumi-azuread with merge commit 26b6031

@github-actions
Copy link

Diff for pulumi-kubernetes with merge commit 26b6031

@github-actions
Copy link

Diff for pulumi-gcp with merge commit 099ef4f

@github-actions
Copy link

Diff for pulumi-gcp with merge commit 26b6031

@github-actions
Copy link

Diff for pulumi-azure with merge commit 099ef4f

@github-actions
Copy link

Diff for pulumi-azure with merge commit 26b6031

@github-actions
Copy link

Diff for pulumi-azure-native with merge commit 099ef4f

@github-actions
Copy link

Diff for pulumi-aws with merge commit 099ef4f

#
# Original example extended to support import cycles and registration
# of sub-modules as attributes.
def _lazy_import(fullname):
Copy link
Member

Choose a reason for hiding this comment

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

Just curious: Why are we moving this into pulumi package now? Is it just to make it easier to make changes to this code (if necessary), without having to the roll out the codegen changes to the various providers (we'd just have to change it once, and release a new pulumi package?)?

Copy link
Member Author

Choose a reason for hiding this comment

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

I mostly wanted it to benefit from living in a py file and having test and lint support. I hope that the functionality will not be updated frequently so pulumi package func is okay? Or are there arguments against it?

#
# Original example extended to support import cycles and registration
# of sub-modules as attributes.
def _lazy_import(fullname):
Copy link
Member

Choose a reason for hiding this comment

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

If we're going to be using this from our SDKs, I do wonder if we should not prefix it with _ and possibly put it in a module that's not also prefixed with _ to make it more clear that this called externally. pulumi.runtime.lazy_import?

Copy link
Member Author

@t0yv0 t0yv0 May 11, 2021

Choose a reason for hiding this comment

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

That makes sense. It's already in _utils.py but I can rename it to lazy_import since it's not module-local.

sdk/python/lib/pulumi/_utils.py Show resolved Hide resolved
@github-actions
Copy link

Diff for pulumi-azuread with merge commit 764f975

@github-actions
Copy link

Diff for pulumi-random with merge commit 764f975

@github-actions
Copy link

Diff for pulumi-kubernetes with merge commit 764f975

@github-actions
Copy link

Diff for pulumi-gcp with merge commit 764f975

@github-actions
Copy link

Diff for pulumi-azure with merge commit 764f975

@github-actions
Copy link

Diff for pulumi-random with merge commit 64ac2c7

@github-actions
Copy link

Diff for pulumi-azuread with merge commit 64ac2c7

@github-actions
Copy link

Diff for pulumi-kubernetes with merge commit 64ac2c7

@github-actions
Copy link

Diff for pulumi-random with merge commit e82cf44

@github-actions
Copy link

Diff for pulumi-azuread with merge commit e82cf44

@github-actions
Copy link

Diff for pulumi-kubernetes with merge commit e82cf44

@github-actions
Copy link

Diff for pulumi-gcp with merge commit e82cf44

@github-actions
Copy link

Diff for pulumi-gcp with merge commit 64ac2c7

@github-actions
Copy link

Diff for pulumi-aws with merge commit 764f975

@github-actions
Copy link

Diff for pulumi-azure-native with merge commit 764f975

@github-actions
Copy link

Diff for pulumi-azure with merge commit e82cf44

@github-actions
Copy link

Diff for pulumi-azure with merge commit 64ac2c7

@github-actions
Copy link

Diff for pulumi-aws with merge commit 64ac2c7

@github-actions
Copy link

Diff for pulumi-azure-native with merge commit 64ac2c7

@github-actions
Copy link

Diff for pulumi-aws with merge commit e82cf44

@github-actions
Copy link

Diff for pulumi-azure-native with merge commit e82cf44

@t0yv0 t0yv0 merged commit 2288f8b into master May 12, 2021
@t0yv0 t0yv0 deleted the t0yv0/fix-lazy-loading-bug branch May 12, 2021 02:48
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.

Inconsistent module objects returned from lazy_import leading to hangs or exceptions
3 participants