Skip to content

Support for Kubernetes Executor side task attempt logging for failed tasks in case of task pods doesn't reach running state - #42412

Closed
dirrao wants to merge 3 commits into
apache:mainfrom
dirrao:k8s_executor_task_logging
Closed

Support for Kubernetes Executor side task attempt logging for failed tasks in case of task pods doesn't reach running state#42412
dirrao wants to merge 3 commits into
apache:mainfrom
dirrao:k8s_executor_task_logging

Conversation

@dirrao

@dirraodirrao commented Sep 23, 2024

Copy link
Copy Markdown
Contributor

Right now, when the tasks fail due to pod launch failures or the pod is stuck in the pending phase, then the task logs from the UI are empty. It is very inconvenient for airflow consumers to debug it. They might not have access to the scheduler logs. We can push these failure reasons from the Kubernetes executor to task logs. So, that airflow consumers can able to see task failure reasons from the UI.

closes: #37435

@boring-cyborgboring-cyborgBot added area:providers provider:cncf-kubernetes Kubernetes (k8s) provider related issues labels Sep 23, 2024
@dirraodirrao self-assigned this Sep 23, 2024
@dirrao
dirrao requested a review from potiukOctober 4, 2024 05:51
@dirrao

Copy link
Copy Markdown
ContributorAuthor

@jedcunningham / @hussein-awala
Can you review this MR when you are free?

@dirrao
dirraoforce-pushed the k8s_executor_task_logging branch from 407476a to 140166fCompareOctober 10, 2024 10:19
@dirrao

Copy link
Copy Markdown
ContributorAuthor

@romsharon98
Can you review it when you are free?

@dirrao

Copy link
Copy Markdown
ContributorAuthor

@jedcunningham / @hussein-awala
Can you review this MR when you are free?

@dirrao

Copy link
Copy Markdown
ContributorAuthor

@dstandish
With the changes introduced in PR #43183, is it still feasible to generate logs from locations other than the workers? If so, could you please provide a few references to explain this?

@dstandish

Copy link
Copy Markdown
Contributor

@dstandish With the changes introduced in PR #43183, is it still feasible to generate logs from locations other than the workers? If so, could you please provide a few references to explain this?

Yes, you add a log record. Was done recently in an aws executor

@dstandish

Copy link
Copy Markdown
Contributor

@dstandish With the changes introduced in PR #43183, is it still feasible to generate logs from locations other than the workers? If so, could you please provide a few references to explain this?

Ok following up with more specifics this morning.

Look at BaseExecutor.log_task_event

executors do not have access to a session, so from executor when we need to send this kind of message, we write the log records to a queue, and the scheduler consumes this queue and writes to db.

cc @potiuk

@potiuk

Copy link
Copy Markdown
Member

Look at BaseExecutor.log_task_event

Nice.

@eladkal

Copy link
Copy Markdown
Contributor

@dirrao what is the status of this PR?

@dirrao

Copy link
Copy Markdown
ContributorAuthor

@dirrao what is the status of this PR?

I’ve implemented the changes on the Kubernetes executor to align with the new base executor feature. However, I’m uncertain about how to adapt these updates in the Kubernetes watcher code.

@amoghrajesh

Copy link
Copy Markdown
Contributor

@dirrao why do you need to push anything to the watcher here?
You writing logs to the task logs should be sufficient right? or am missing something

@dstandish

Copy link
Copy Markdown
Contributor

TaskContextLogger is removed from airflow; this PR needs to be updated to use the log table. The feature was added in this pr #40867 and you can see an example of its usage there.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.

@github-actionsgithub-actionsBot added the stale Stale PRs per the .github/workflows/stale.yml policy file label Feb 10, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providersprovider:cncf-kubernetesKubernetes (k8s) provider related issuesstaleStale PRs per the .github/workflows/stale.yml policy file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for Kubernetes Executor side task attempt logging for failed tasks in case of task pods doesn't reach running state

5 participants

@dirrao@dstandish@potiuk@eladkal@amoghrajesh