-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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
Refactor monolithic ECS Operator into Operators, Sensors, and a Hook #25413
Conversation
Looks like I missed removing a deprecation somewhere, looking into it. |
Sorry about that, all passing 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.
There are several places where code is removed.
We should deprecate first
@@ -1,30 +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.
This file can be removed only in Airflow 3 as its part of Airflow core so we can not remove it yet.
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.
But it's so olllllldddddddd. Git Blame shows that it was deprecated at least 2 years ago. If it needs to stay, I'll add it back.
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.
When I revert this, what is the best way to handle it? Should I import all of the new ECS Operators fro this PR and add them to __all__
, or only update the names of the ones which were already included in there?
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.
Regardless contrib files cant not be removed. In this specific case we must be backward compatible till Airflow 3
As for your question - in this file you need to support only classes that existed. We dont add new functionality
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 have an idea for the future. Should we move alll the deprecated/contrib operators from 1.10 out to a separate "apache-contrib" package (when we split out providers).
That will allow to get rid of the contrib, and get rid of many 1.10 deprecations out of airlfow main repo at least (it can still be a dependency of Airflow package so that it is installed automatically when airflow is installed). @ashb @kaxil 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.
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.
It will take me a few days to get to this
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 can take this one. But you need to rebase @ferruzzi - this one has problems from few days back when we fixed Flask 2.2 compatibility:
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.
ACK. Will rebase and do a force-push. Done.
Thanks to both of you for the help.
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 was a bit confused on how that chain of depredations should play out, but now with #25543 I'm doubly confused on how the two will interact.
Unless I made a mistake, I only removed code which has been deprecated for quite some time. [edit] Deleted:
Moved or Renamed and deprecated:
Moved from operator to the new hook but not deprecated:I feel these two are "private" methods, though they don't have the underscore. I can definitely add deprecation classes for them if you'd like.
|
9e07d5f
to
d1e27e0
Compare
d1e27e0
to
ea74ca3
Compare
Rebased and fixed (??) the deprecation notice. This passes testing locally, let's see if it works. |
If the tests pass, do you think we should be fine with releasing it in this upcoming wave of providers? |
Ah yeah. I see the comment now :) |
I wont have time today to review the code.. i didnt do full review when I left the comment. If the PR is OK from your side dont let me get in the way :) |
Alright, it just went green, so at least the CI is happy. @jarek - My main reason for wanting it in this release was because it's removing deprecated code. Based on a chat with @eladkal, it doesn't sound like he thinks that's such a big deal. If you both think that isn't a good enough reason to hold up the release then by all means push on without it. |
ea74ca3
to
bbd6efb
Compare
@potiuk Rebase done, passes all CI and static tests locally |
self.aws_conn_id = kwargs.get('aws_conn_id', DEFAULT_CONN_ID) | ||
self.region = kwargs.get('region') | ||
super().__init__(**kwargs) |
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.
oh man, you passed all kwargs including the aws_conn_id
to the BaseOperator
now 80% of my dags (i use EcsOperator heavily) are failing with
Broken DAG: [/usr/local/airflow/dags/my_dag.py] Traceback (most recent call last):
File "/usr/local/airflow/.local/lib/python3.8/site-packages/airflow/models/baseoperator.py", line 390, in apply_defaults
result = func(self, **kwargs, default_args=default_args)
File "/usr/local/airflow/.local/lib/python3.8/site-packages/airflow/models/baseoperator.py", line 743, in __init__
raise AirflowException(
airflow.exceptions.AirflowException: Invalid arguments were passed to EcsOperator (task_id: my-task). Invalid arguments were:
**kwargs: {'aws_conn_id': 'aws_default'}
is there a fix? will 2 simple pops do the job?
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.
nvm, #25989
The current EcsOperator is monolithic, does not have a hook, nor any sensors. This PR adds an ECS hook, modifies the existing EcsOperator to use it, adds a handful of other operators and sensors. The functionality of the existing EcsOperator was changed as little as possible. A future refactor of that operator might not be a bad idea, but adding the hook and sensors is the main goal of this PR.
Other changes:
airflow/contrib/operators/ecs_operator.py
was deprecated over 2 years agotests/providers/amazon/aws/operators/test_ecs_system.py
is also a few years old and not a proper system test by current standards.EcsOperator
in favor ofEcsRunTaskOperator
to match the standard naming conventions since there are now multiple ECS-related operators.closes: #24826