Skip to content

Commit

Permalink
KubernetesPodTrigger: add stacktrace to event message
Browse files Browse the repository at this point in the history
Ref #34644
  • Loading branch information
functicons committed Nov 18, 2023
1 parent 429ca47 commit 5cd17c9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions airflow/providers/cncf/kubernetes/operators/pod.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,7 @@ def invoke_defer_method(self):
)

def execute_complete(self, context: Context, event: dict, **kwargs):
self.log.info("Triggered with event: %s", event)
pod = None
try:
pod = self.hook.get_pod(
Expand Down
4 changes: 3 additions & 1 deletion airflow/providers/cncf/kubernetes/triggers/pod.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import asyncio
import datetime
import traceback
import warnings
from asyncio import CancelledError
from enum import Enum
Expand Down Expand Up @@ -225,12 +226,13 @@ async def run(self) -> AsyncIterator[TriggerEvent]: # type: ignore[override]
)
except Exception as e:
self.log.exception("Exception occurred while checking pod phase:")
stack_trace = traceback.format_exc()
yield TriggerEvent(
{
"name": self.pod_name,
"namespace": self.pod_namespace,
"status": "error",
"message": str(e),
"message": f"{str(e)}\n{stack_trace}",
}
)

Expand Down

0 comments on commit 5cd17c9

Please sign in to comment.