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

Avoid creating the hook in the EmrServerlessCancelJobsTrigger init #35992

Merged

Conversation

hussein-awala
Copy link
Member

This might be considered a breaking change, but it's completely useless to create the hook in the init method because we create an instance from the trigger in the operator when we defer it, which means an extra needed DB query to fetch the secrets.

The original reason for this implementation was accessing JOB_INTERMEDIATE_STATES list, which is a class param, so no need to create an instance from the class to get it.

cc: @eladkal

Comment on lines +465 to +468
@property
def hook_instance(self) -> AwsGenericHook:
"""This property is added for backward compatibility."""
return self.hook()
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 added hook_instance as a property, so it will be available when the user tries to access it, but it's lazy evaluated and created only when accessing it.

That makes the change backward compatible.

@hussein-awala hussein-awala merged commit eed6427 into apache:main Nov 30, 2023
47 checks passed
@eladkal
Copy link
Contributor

eladkal commented Dec 1, 2023

This might be considered a breaking change, but it's completely useless to create the hook in the init method because we create an instance from the trigger in the operator when we defer it, which means an extra needed DB query to fetch the secrets.

I dont think this qualify as breaking change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:providers provider:amazon-aws AWS/Amazon - related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants