-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Fix RuntimeError when using OpensearchTaskHandler as remote log handler #53529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
First, I saw the pr. Good. |
|
The bug only shows up when Airflow is started with From what I read, Airflow core purposely doesn’t want to import specific provider code (other than the common code obviously) at test time; the handler is pulled in dynamically at runtime based on config. The failure path involves the full request stack (TaskLogReader → ConfigResponse) plus the provider package. A unit test that stubs settings.remote_log_handler won’t tell us whether the real handler can be instantiated, its dependencies load, and the JSON flag is set end‑to‑end. Speaking more broadly - I think there's an integration test gap here. I couldn’t find any existing integration test that boots Airflow with each remote‑log provider and hits /config. Providers do have isolated unit tests, but nothing that covers the cross‑boundary behaviour we’re touching here |
Actually this is because of lack of ABCMeta meta-class in definition of ExternalLoggingMixin. All the "External" handlers derive from it and since ExternalLoggingMixin does not have ABCMeta as Metaclass, so you can instantiate the derived classes even if the methods are declared as abstract methods:
@Owen-CH-Leung -> Maybe you can fix it as part of that PR (that would be equivalent of tests). What should happen when you add the metaclass, regular unit tests should fail for all the log handlers that have missing abstract methods because it will be impossible to instantiate them. |
|
Thanks. I've set |
Yep. As expected :) |
|
Just thinking... if there will be other providers that will fail after that one (I just realized it only run a subset of provider tests) - if the main will be failing we will have to make a follow-up PR. |

closes: #53527
Airflow 3 introduces several mandatory variable for
api-server. One of them isshow_external_log_redirectin theConfigResponseclassairflow/airflow-core/src/airflow/api_fastapi/core_api/datamodels/ui/config.py
Line 36 in fa60229
This class will be validated by
pydanticand if the validation fails, it returns runtime error as described in the issueSuch validation will take place when
api-serveris up and running and a http request is sent to the endpoint/config.airflow/airflow-core/src/airflow/api_fastapi/core_api/routes/ui/config.py
Lines 44 to 49 in fa60229
Inside this handler function, an instance of
TaskLogReaderis created, andshow_external_log_redirectwill take the attribute value ofsupports_external_linkin the task log readerClass
TaskLogReaderdoes have thie propertysupports_external_link, which will delegate it to the log handler'ssupports_external_linkairflow/airflow-core/src/airflow/utils/log/log_reader.py
Lines 147 to 153 in fa60229
But
OpensearchTaskHandlerdoes not impl this property. Hence None is sent to pydantic for validation and hence the error.