The GitHub Actions job "Tests" on airflow.git has succeeded.
Run started by GitHub user ashb (triggered by ashb).

Head commit for run:
05ea15f7993f485bf8dd3e36ce1cd563934c2305 / Ash Berlin-Taylor <[email protected]>
Simplify Task exception trackback truncation to never warn

There are a few ways we can get an exception before ever making it to
user code, and if that happens _also_ warning about "this shouldn't
happen" is obfuscating the original error.

Before:

```
[2022-04-20, 14:48:44 BST]  1103834 QueuedLocalWorker-3 
{{airflow.models.taskinstance.TaskInstance taskinstance.py:1865}} WARNING - We 
expected to get frame set in local storage but it was not. Please report this 
as an issue with full logs at https://github.com/apache/airflow/issues/new
Traceback (most recent call last):
  File "/home/ash/code/airflow/airflow/airflow/models/taskinstance.py", line 
1442, in _run_raw_task
    self._execute_task_with_callbacks(context, test_mode)
  File "/home/ash/code/airflow/airflow/airflow/models/taskinstance.py", line 
1546, in _execute_task_with_callbacks
    task_orig = self.render_templates(context=context)
  File "/home/ash/code/airflow/airflow/airflow/models/taskinstance.py", line 
2210, in render_templates
    rendered_task = self.task.render_template_fields(context)
  File "/home/ash/code/airflow/airflow/airflow/models/mappedoperator.py", line 
724, in render_template_fields
    unmapped_task = self.unmap(unmap_kwargs=kwargs)
  File "/home/ash/code/airflow/airflow/airflow/models/mappedoperator.py", line 
510, in unmap
    op = self.operator_class(**unmap_kwargs, _airflow_from_mapped=True)
  File "/home/ash/code/airflow/airflow/airflow/models/baseoperator.py", line 
390, in apply_defaults
    result = func(self, **kwargs, default_args=default_args)
  File 
"/home/ash/code/airflow/airflow/airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py",
 line 259, in __init__
    self.name = self._set_name(name)
  File 
"/home/ash/code/airflow/airflow/airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py",
 line 442, in _set_name
    raise AirflowException("`name` is required unless `pod_template_file` or 
`full_pod_spec` is set")
airflow.exceptions.AirflowException: `name` is required unless 
`pod_template_file` or `full_pod_spec` is set

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ash/code/airflow/airflow/airflow/models/taskinstance.py", line 
1863, in get_truncated_error_traceback
    execution_frame = _TASK_EXECUTION_FRAME_LOCAL_STORAGE.frame
AttributeError: '_thread._local' object has no attribute 'frame'
[2022-04-20, 14:48:44 BST]  1103834 QueuedLocalWorker-3 
{{airflow.models.taskinstance.TaskInstance taskinstance.py:1896}} ERROR - Task 
failed with exception
Traceback (most recent call last):
  File "/home/ash/code/airflow/airflow/airflow/models/taskinstance.py", line 
1442, in _run_raw_task
    self._execute_task_with_callbacks(context, test_mode)
  File "/home/ash/code/airflow/airflow/airflow/models/taskinstance.py", line 
1546, in _execute_task_with_callbacks
    task_orig = self.render_templates(context=context)
  File "/home/ash/code/airflow/airflow/airflow/models/taskinstance.py", line 
2210, in render_templates
    rendered_task = self.task.render_template_fields(context)
  File "/home/ash/code/airflow/airflow/airflow/models/mappedoperator.py", line 
724, in render_template_fields
    unmapped_task = self.unmap(unmap_kwargs=kwargs)
  File "/home/ash/code/airflow/airflow/airflow/models/mappedoperator.py", line 
510, in unmap
    op = self.operator_class(**unmap_kwargs, _airflow_from_mapped=True)
  File "/home/ash/code/airflow/airflow/airflow/models/baseoperator.py", line 
390, in apply_defaults
    result = func(self, **kwargs, default_args=default_args)
  File 
"/home/ash/code/airflow/airflow/airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py",
 line 259, in __init__
    self.name = self._set_name(name)
  File 
"/home/ash/code/airflow/airflow/airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py",
 line 442, in _set_name
    raise AirflowException("`name` is required unless `pod_template_file` or 
`full_pod_spec` is set")
airflow.exceptions.AirflowException: `name` is required unless 
`pod_template_file` or `full_pod_spec` is set
```

This refactors the approach we use to not need thread local as we always
truncate to the same place, but instead to just walk the traceback and
examine the code object until we find the one we want.

Report URL: https://github.com/apache/airflow/actions/runs/2197608910

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to