Skip to content

Update ecs_task_id on reattaching#22879

Closed
fshehadeh wants to merge 2 commits into
apache:providers-amazonfrom
fshehadeh:providers-amazon
Closed

Update ecs_task_id on reattaching#22879
fshehadeh wants to merge 2 commits into
apache:providers-amazonfrom
fshehadeh:providers-amazon

Conversation

@fshehadeh

Copy link
Copy Markdown
Contributor

Resolve an issue that can occur when reattaching to ECS tasks.

closes: #22878

The code for fetching AWS logs, looks for the ecs_task_id field. When executing the task for the first time, this is updated after fetching the ARN for the first time. However, when the task is reattached to an existing ECS task, the current code will update the ARN, but will not update the ecs_task_id. The code change will ensure that the ecs_task_id is updated when the ARN is updated at the time of reattaching.

@boring-cyborg boring-cyborg Bot added area:providers provider:amazon AWS/Amazon - related issues labels Apr 9, 2022
@boring-cyborg

boring-cyborg Bot commented Apr 9, 2022

Copy link
Copy Markdown

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst)
Here are some useful points:

  • Pay attention to the quality of your code (flake8, mypy and type annotations). Our pre-commits will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it’s a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@eladkal

eladkal commented Apr 13, 2022

Copy link
Copy Markdown
Contributor

Is it possible to add unit test to cover this change?

@potiuk

potiuk commented Apr 14, 2022

Copy link
Copy Markdown
Member

Is it possible to add unit test to cover this change?

Yep. We should

@fshehadeh

Copy link
Copy Markdown
Contributor Author

I updated the test for the ECS operator to verify that the ID is always updated and matches the last part of the ARN. I am waiting to see how it will run on CI/CD (I don't have the setup to build or run all unit tests)

)
if previous_task_arn in running_tasks:
self.arn = previous_task_arn
self.ecs_task_id = self.arn.split("/")[-1]

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.

Small nit: When I had coded this (before I knew you were working on it 😆) I extracted setting the arn/task_id into a helper method, because this code is now duplicated in two spots. Not a huge deal, since ARNs are fairly stable, but worth considering. Approving

@potiuk

potiuk commented Apr 25, 2022

Copy link
Copy Markdown
Member

Needs rebase.

@fshehadeh

Copy link
Copy Markdown
Contributor Author

Needs rebase.

@potiuk: could you please provide more details about the "rebase"?

@potiuk

potiuk commented Apr 29, 2022

Copy link
Copy Markdown
Member

You will find it in the contributing doc (you got the link when you created your first PR). Just look for rebase there - it has all explanations and howtos.

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are
unsure about any anything please check our
Contribution Guide

@fshehadeh

Copy link
Copy Markdown
Contributor Author

@potiuk: I followed the instructions using my "providers-amazon" branch, and the upstream "providers-amazon" branch from the upstream airflow repo. When I asked for a rebase, it didn't do anything, since it didn't seem that anything was made to the upstream branch since the changes that I made.

The instructions on the contributing document talk about the main branch, but I assumed that I should be using the 'providers-amazon" branch instead.

I am probably missing something simple here, please let me know what I should do next.

@potiuk

potiuk commented Apr 29, 2022

Copy link
Copy Markdown
Member

No. It's main branch. All changes in Airflow are done to main. You should not contribute anything to other branches.

@potiuk
potiuk deleted the branch apache:providers-amazon April 29, 2022 16:15
@potiuk potiuk closed this Apr 29, 2022
@potiuk

potiuk commented Apr 29, 2022

Copy link
Copy Markdown
Member

I deleted that branch - it was there by mistake. You should re-do your PR based on main./

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.

5 participants