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

test AssetExecutionContext subclass deprecations #16598

Closed

Conversation

jamiedemaria
Copy link
Contributor

@jamiedemaria jamiedemaria commented Sep 18, 2023

Summary & Motivation

Adds a test to ensure that AssetExecutionContext stays in sync with OpExecutionContext. We don't want methods added to OpExecutionContext without their corresponding deprecated versions added to AssetExecutionContext, otherwise splitting AssetExecutionContext into it's own class will be a breaking change. This test goes through each attr on OpExecutionContext and ensure that it's either:

  • a method we want to keep on AssetExecutionContext
  • has a deprecation warning on AssetExecutionContext
  • some other attribute we want to ignore (ie __ methods)

How I Tested These Changes


other_ignores = [
"_abc_impl",
# TODO - what to do about instance vars for OpExecutionContext? listed below
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The below attributes are instance variables on OpExecutionContext that are not available on AssetExecutionContext because AssetExecutionContext overrides the __init__ of OpExecutionContext. We could:

  • make properties for each of these attrs on AssetExecutionContext and throw deprecation warnings
  • do nothing since the underscore implies they are private. But there's probably a user somewhere who is calling these, and their code would break

Copy link
Member

Choose a reason for hiding this comment

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

IMO we should be able to break users that are accessing private members

@jamiedemaria jamiedemaria marked this pull request as ready for review September 18, 2023 18:40
Copy link
Member

@schrockn schrockn left a comment

Choose a reason for hiding this comment

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

Don't think we should intercept calls to private members...

Comment on lines 10 to 18
# Test that every method on OpExecutionContext is either reimplemented by AssetExecutionContext
# or throws a deprecation warning on AssetExecutionContext

# If this test fails, it is likely because you added a method to OpExecutionContext without
# also adding that method to AssetExecutionContext. Please add the same method to AssetExecutionContext
# with an appropriate deprecation warning (see existing deprecated methods for examples).
# If the method should not be deprecated for AssetExecutionContext, please still add the same method
# to AssetExecutionContext and add the method name to asset_execution_context_attrs
Copy link
Member

Choose a reason for hiding this comment

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

great summary

@jamiedemaria jamiedemaria force-pushed the jamie/provide-asset-context branch from 12894b6 to ec70892 Compare September 18, 2023 20:14
@jamiedemaria jamiedemaria force-pushed the jamie/test-asset-context branch from 896a7d2 to 9d026e9 Compare September 18, 2023 20:14
@jamiedemaria jamiedemaria requested a review from yuhan September 18, 2023 20:53
@jamiedemaria jamiedemaria force-pushed the jamie/provide-asset-context branch from ec70892 to a09fa99 Compare September 19, 2023 14:27
@jamiedemaria jamiedemaria force-pushed the jamie/test-asset-context branch from 9d026e9 to beae87d Compare September 19, 2023 14:27
@jamiedemaria jamiedemaria force-pushed the jamie/provide-asset-context branch from a09fa99 to bcf4e6e Compare September 19, 2023 21:38
@jamiedemaria jamiedemaria changed the base branch from jamie/provide-asset-context to jamie/direct-invocation September 19, 2023 21:39
@jamiedemaria jamiedemaria force-pushed the jamie/test-asset-context branch from beae87d to 945482e Compare September 19, 2023 21:39
@jamiedemaria jamiedemaria force-pushed the jamie/direct-invocation branch from 682fb19 to d596c86 Compare September 19, 2023 23:43
@jamiedemaria jamiedemaria force-pushed the jamie/test-asset-context branch from 945482e to 9fbf870 Compare September 19, 2023 23:43
@jamiedemaria jamiedemaria force-pushed the jamie/direct-invocation branch from d596c86 to 9c78c7e Compare September 20, 2023 00:04
@jamiedemaria jamiedemaria force-pushed the jamie/test-asset-context branch from 9fbf870 to 5d3c659 Compare September 20, 2023 00:04
@jamiedemaria jamiedemaria force-pushed the jamie/direct-invocation branch from 9c78c7e to 7c6b42a Compare September 20, 2023 16:43
@jamiedemaria jamiedemaria force-pushed the jamie/test-asset-context branch from 5d3c659 to c9751d3 Compare September 20, 2023 16:43
@jamiedemaria jamiedemaria force-pushed the jamie/direct-invocation branch from 7c6b42a to 431ffab Compare September 20, 2023 17:08
@jamiedemaria jamiedemaria force-pushed the jamie/test-asset-context branch from ef91ce0 to 72e04ec Compare September 22, 2023 13:08
@jamiedemaria jamiedemaria force-pushed the jamie/direct-invocation branch from 1919f73 to 384d390 Compare September 22, 2023 14:27
@jamiedemaria jamiedemaria force-pushed the jamie/test-asset-context branch from 72e04ec to 3d8e088 Compare September 22, 2023 14:27
@jamiedemaria jamiedemaria force-pushed the jamie/direct-invocation branch from 384d390 to 5c4494f Compare September 22, 2023 15:16
@jamiedemaria jamiedemaria force-pushed the jamie/test-asset-context branch from 3d8e088 to 5fad4f7 Compare September 22, 2023 15:16
@jamiedemaria jamiedemaria force-pushed the jamie/direct-invocation branch from 5c4494f to 2c59e3b Compare September 22, 2023 16:02
@jamiedemaria jamiedemaria force-pushed the jamie/test-asset-context branch from 5fad4f7 to 4c8533d Compare September 22, 2023 16:02
@jamiedemaria jamiedemaria force-pushed the jamie/direct-invocation branch from 2c59e3b to ab3472a Compare September 22, 2023 17:47
@jamiedemaria jamiedemaria force-pushed the jamie/test-asset-context branch from 4c8533d to f821ec9 Compare September 22, 2023 17:47
@jamiedemaria jamiedemaria force-pushed the jamie/direct-invocation branch from ab3472a to 2b23f4f Compare September 22, 2023 20:50
@jamiedemaria jamiedemaria force-pushed the jamie/test-asset-context branch from f821ec9 to ff9ba61 Compare September 22, 2023 20:50
@jamiedemaria jamiedemaria force-pushed the jamie/direct-invocation branch from 2b23f4f to db73b3c Compare September 26, 2023 14:06
@jamiedemaria jamiedemaria force-pushed the jamie/test-asset-context branch from ff9ba61 to ee3aac2 Compare September 26, 2023 14:06
@jamiedemaria jamiedemaria marked this pull request as draft October 13, 2023 19:16
@jamiedemaria
Copy link
Contributor Author

converting to draft to get it out of review queues - this will need to be re-opened once we start deprecating methods on AssetExecutionContext

@jamiedemaria
Copy link
Contributor Author

#17339 replaces this

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.

2 participants