-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Add on_finish_action to KubernetesPodOperator
#30718
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
Conversation
| :param is_delete_operator_pod: What to do when the pod reaches its final | ||
| state, or the execution is interrupted. If True (default), delete the | ||
| pod; if False, leave the pod. | ||
| :param delete_when_fails: If False, and is_delete_operator_pod is set to True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels a bit complicated.
I think we should consider replace is_delete_operator with:
action_on_finish that supports several modes. For example: delete_pod, delete_pod_success
That way you dont need to work hard to understand the combinationa of flags, the mode is self explanatory.
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My first thought was doing something similar to #29394, but I hesitated to deprecate is_delete_operator_pod, but yes, these flags may confuse users. I'll implement the argument you propose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @jedcunningham WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. Agree with @eladkal simple flag is better. I made similar "keep old flag" approaches in the past and it led to really bad complexity/
potiuk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this. Needs conflict resolving though. @jedcunningham @dstandish ?
jedcunningham
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
System test examples need updating, particularly as they get sucked into the docs.
Are you planning to change the operators based on KPO in a followup PR? Just want to make sure it isn't missed. For example, the eks pod operator.
Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com>
@jedcunningham yes, in this PR, I have ensured that it is fully backward compatible. This means that users can update the airflow/airflow/providers/cncf/kubernetes/operators/pod.py Lines 387 to 393 in a99e3ba
Once this PR is merged, I'll create a separate PR for each provider to deprecate the argument |
We can do it in this PR if you prefer.. no reason to keep it in seperated PRs unless that is how you prefer. |
|
@eladkal we have this message added 15 months ago in the version 3.0.0 of Amazon provider, and we are releasing the version 8.0.0 without doing anything
Also we have a warning on the None |
|
Same warning added to Google provider in 6.4.0, and we are releasing 10.0.0 |
We don't have provider deprecation policy - we remove deprecated things when we see that they woudl be helpful in cleaning up the code. |
|
BTW. @eladkal is big proponent of removal of all deprecations when we release a breaking version. I am a bit more cautiouss, but I have no problem with that. |
|
IMHO we can merge this PR without updating the operators |
It's OK to update multiple providers in one PR. I see no reason to break backward compatibility in any provider. |
|
Okay, I'll add them. |
|
The issue with these operators is that the default Using |
|
Any update on this? if In some cases, Its unclear why pod has been removed. Cant tell from the output |
|
i am late to the party here. that said, what about the following... keep then it maintains a little more continuity and the name stays more tailored to what is actually being controlled, and we don't have to add any more deprecations. then it could be is_delete_operator_pod=DeletePodCondition.TaskFailure one thing that pops out for me re the name on_finish_action... it kind of sounds like it's a more elaborate "callback" feature. anyway, just a suggestion |
Is this a concern only for google provider? airflow/airflow/providers/google/provider.yaml Lines 1121 to 1123 in dc5bf3f
Should we consider bumping the dependency |
@eladkal +1, bu we should add the same dependency to AWS provider, is that possible? |
| - aiobotocore[boto3]>=2.2.0 | ||
| - name: cncf.kubernetes | ||
| dependencies: | ||
| - apache-airflow-providers-cncf-kubernetes>=8.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think 8.0.0 is right?
There is no such version for cncf.kubernetes
I believe it should be:
apache-airflow-providers-cncf-kubernetes>7.0.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think >=8.0.0 is fine, and we have to release those three packages together. There should be 8.0.0 release of cncf.kubernetes coming together with releasing of those two providers (the changes in cncf.kubernetes it brings are breaking, so that's expected to be bumped to 8.0.0.
Comment: The "additional" dependencies are pretty special because they are mostly "informatory". Almost no-one will install apache-airflow-providers-amazon[cncf.kubernetes]==8.3.0 - what is mainly the purpose of those is to be document the dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
w8.. I'm missing something here.
In this PR we add a feature to apache-airflow-providers-cncf-kubernetes that feature is what needed for amazon and google provider so what we are after is setting dependency for the next version of apache-airflow-providers-cncf-kubernetes thus the condition should be:
apache-airflow-providers-cncf-kubernetes>=7.2.0
Currently stable version of cncf.kubernetes is 7.1.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this PR we add a feature to
apache-airflow-providers-cncf-kubernetesthat feature is what needed for amazon and google provider so what we are after is setting dependency for the next version ofapache-airflow-providers-cncf-kubernetesthus the condition should be:
Ah ok. If that's not a breaking change, then yes. I have not looked in detail enough and badly classified upcoming cncf.kubernetes version as MAJOR upgrade.
This is really the result of our release process and why in the past I was leaving all the version upgrades to the release manager "documentation preparation" - because literally we do not know if the next version will be MINOR or MAJOR upgrade until we merge last change. I think it's next to impossible to change it unless we would have a much more active RM role upfront (RM would have to make versioning decisions upfront and for example hold breaking changes from being merged if the next release is non-breaking, but I feel that is quite impossible with our volunteer-driven organisation).
Ideally we should have in this case >= NEXT_CNCF_KUBERNETES_PROVIDER_VERSION that could be automatically changed when the release documentation is prepared - because this is what we have here, really. But it's yet another automation complexity and feels like a bit of an edge-case that can be handled manually.
And in edge-cases like that it's hard to have a process to follow for every single case like that, so it's case-by-case basis.
Side note. Assuming that we do not know if the next release is MINOR or MAJOR we could add >=MINOR_UPGRADE always. It's a bit limiting and slightly confusing for the users if we do MAJOR release instead, but technically it would work.
For example in this case we could agree to have >=7.2.0 here independently if the next version is MAJOR or MINOR. Even if we release 8.0.0, that would still technicaly work (8.0.0 >= 7.2.0), but there would be no 7.2.0 release at all., However (except confusing the users) there is also a side effect that it would not alow us (we don't do it anyway but techniclaly there is such a possiblity with mixed-governance model) to release 7.2.0 after the 8.0.0. Technically (and purely theoretically because we've never done so) we could have it and then the >=7.2.0 would be wrong if the features needed will not be cherry-picked to the v7 branch of the provider.
But I think it's better to get it right even if it requires a bit of discussion and "humans-in-the-loop" agreeing on details of such versioning question (as we do now).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Side note. Assuming that we do not know if the next release is MINOR or MAJOR we could add >=MINOR_UPGRADE always. It's a bit limiting and slightly confusing for the users if we do MAJOR release instead, but technically it would work.
I like this idea, I added 8.0.0 because I didn't know if there is any breaking changes on the other PRs, but yes 7.2.0 will work for both minor and major releases 👍
|
|
Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
on_finish_action to KubernetesPodOperator
|
Great work @hussein-awala ! |
Add a new argument
on_finish_actionforKubernetesPodOperatorto determine how to deal with the finished pods. There are 3 possible values:delete_pod: delete the pod regardless its statedelete_succeeded_pod: delete the pod if it terminate withSucceededstatekeep_pod: keep the pod and don't delete it