jedcunningham commented on code in PR #36968:
URL: https://github.com/apache/airflow/pull/36968#discussion_r1463064242
##########
tests/models/test_taskinstance.py:
##########
@@ -3192,6 +3192,22 @@ def raise_skip_exception():
assert State.SKIPPED == ti.state
assert callback_function.called
+ def test__run_raw_task_decorated_with_sentry_enrich_errors(self,
create_task_instance):
+ """
+ Test TaskInstance._run_raw_task is decorated with encountering error.
+ """
+ ti = create_task_instance()
+ ti._run_raw_task()
Review Comment:
How are these new tests checking that the methods are decorated?
##########
airflow/sentry.py:
##########
@@ -178,8 +179,12 @@ def wrapper(_self, *args, **kwargs):
with sentry_sdk.push_scope():
try:
- # Is a LocalTaskJob get the task instance
- if hasattr(_self, "task_instance"):
+ ti_from_kwargs = kwargs.get("ti", None)
+ if ti_from_kwargs:
+ # Get taskinstnace from
TaskInstnace._schedule_downstream_tasks
Review Comment:
```suggestion
# Get taskinstance from
TaskInstance._schedule_downstream_tasks
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]