Skip to content

Use waiters in ECS Operators instead of inner sensors - #29761

Merged
o-nikolas merged 4 commits into
apache:mainfrom
Taragolis:ecs-operators-waiters
Mar 1, 2023
Merged

o-nikolas merged 4 commits into
apache:mainfrom
Taragolis:ecs-operators-waiters

Conversation

@Taragolis

Copy link
Copy Markdown
Contributor

closes: #29556

Use custom botocore.Waiters instead of inner sensors in ECS Operators

@Taragolis
Taragolis requested a review from ferruzzi February 25, 2023 12:16
@boring-cyborg boring-cyborg Bot added area:providers provider:amazon AWS/Amazon - related issues labels Feb 25, 2023
Comment on lines 239 to 241

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

To be honest this happen almost always 🤣

@Taragolis Taragolis Feb 25, 2023 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This for allow comparison EcsClusterStates.ACTIVE == "ACTIVE" unfortunetly class StrEnum available only in python 3.11

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yeah, I was hoping to use StrEnum there but... not yet. :( I didn't know you could do it this way, nice.

@Taragolis
Taragolis force-pushed the ecs-operators-waiters branch from 1a1868b to 7a81b8e Compare February 25, 2023 12:36

@ferruzzi ferruzzi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Left a couple of suggestions in the waiter config file specifically. Non-blocking.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yeah, I was hoping to use StrEnum there but... not yet. :( I didn't know you could do it this way, nice.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Love seeing this put to use. I think it's so much cleaner in the implementation. 👍

Comment on lines 28 to 31

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Interesting catch. 👍

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hehe, I've looked into builtin botocore waiters for ECS: https://github.com/boto/botocore/blob/develop/botocore/data/ecs/2014-11-13/waiters-2.json

And after that I checked which state available for different API calls https://docs.aws.amazon.com/AmazonECS/latest/developerguide/api_failures_messages.html

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No failure states for this one? I think if the status goes to 'DELETE_IN_PROGRESS' it can fail early. Not sure where 'INACTIVE' is on the state flow on this call though.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah 'DELETE_IN_PROGRESS' it could be some kind failure step, I can't imagine how it possible that state changed to this state during create task definition, but why not to add it as failure.

@ferruzzi ferruzzi Feb 27, 2023 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pretty much my thought as well. I don't how it would get there, but if it did then something is clearly wrong so there's no point waiting for the timeout.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would 'DELETE_IN_PROGRESS' be a success state here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'd rather say it intermediate state in case of delete task definition.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice. I have a bunch of EMR waiters I have been workigb on converting over but put on pause to verify how they behave if None is passed in, but this would solve that nncely. I'll get the EMR ones up this week and tag you in them. 👍

@Taragolis
Taragolis force-pushed the ecs-operators-waiters branch from 7a81b8e to d3928d7 Compare February 27, 2023 20:30

@ferruzzi ferruzzi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Love it. Thanks!

@eladkal eladkal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice!

@o-nikolas o-nikolas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice addition!

Just some wording suggestions and a question or two.

@ferruzzi ferruzzi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks like everything got fixed. Approved 👍

@o-nikolas
o-nikolas merged commit 181a825 into apache:main Mar 1, 2023
@ferruzzi

ferruzzi commented Mar 1, 2023

Copy link
Copy Markdown
Contributor

ECS System test is failing after this merge, the await_cluster task (which calls EcsClusterStateSensor) is timing out after logging INFO airflow.task.operators:ecs.py:98 Cluster state: EcsClusterStates.ACTIVE, waiting for: EcsClusterStates.ACTIVE. I'll try to take a look at it tomorrow

@Taragolis
Taragolis deleted the ecs-operators-waiters branch March 2, 2023 08:26
@Taragolis

Copy link
Copy Markdown
Contributor Author

ECS System test is failing after this merge, the await_cluster task (which calls EcsClusterStateSensor) is timing out after logging INFO airflow.task.operators:ecs.py:98 Cluster state: EcsClusterStates.ACTIVE, waiting for: EcsClusterStates.ACTIVE. I'll try to take a look at it tomorrow

And this a bit strange, because after this logger record, as I could see there is no external calls (to AWS) and only simple validation which should finished in a milliseconds

@Taragolis

Copy link
Copy Markdown
Contributor Author

Yep locally it also checked forever ¯\_(ツ)_/¯

I guess it is combination of airflow serializer, templated fields and multi inheritance (which I add for enums)

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers provider:amazon AWS/Amazon - related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Different AWS ECS Operators use inner Sensor and do not propagate connection arguments

4 participants