question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ECSOperator returns last logs when ECS task fails

See original GitHub issue

Description

Currently when the ECSOperator fails because the ECS task is not in ‘success’ state it returns a generic message like that in Airflow alerts that doesn’t have much value when we want to debug things quickly.

This task is not in success state {<huge JSON from AWS containing all the ECS task details>}

Use case / motivation

This is to make it faster for people to fix an issue when a task running ECSOperator fails.

Proposal

The idea would be to return instead the last lines of logs from Cloudwatch (that are printed above in Airflow logs) so when we receive the alert we know what failed in the ECS task instead of having to go to Airflow logs to find it. This feature would involve changes there I think:

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
uranusjrcommented, Jul 19, 2021

We can probably use collections.deque for better performance, but aside from that, sounds good to me! Would you be interested in opening a pull request for this?

p.s. I don’t think IndexError can ever be raised?

0reactions
potiukcommented, Jul 19, 2021

Assigned you @pmalafosse

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshoot ECS tasks stopping or failing to start
To identify why your tasks stopped, follow these troubleshooting steps: Check for diagnostic information in the service event log.
Read more >
Source code for airflow.providers.amazon.aws.operators.ecs
This is to avoid relaunching a new task when the connection drops between Airflow and ECS while the task is running (when the...
Read more >
Displaying ECS Fargate logs in Airflow UI - The swamp
So luckily Airflow ECS Operator supports displaying those logs from the Fargate task within ... and an Airflow task is marked as failed....
Read more >
EcsOperator - Astronomer Registry
Execute a task on AWS ECS (Elastic Container Service) ... from the last Cloudwatch logs to return in the AirflowException if an ECS...
Read more >
Airflow ECS-Operator not fetching CloudWatch Logs
If I understand correctly by default fetch_interval is 30 seconds and the worker will fetch the log anyway when the task is complete/fails....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found