Add ElasticsearchRemoteLogIO.from_config and register elasticsearch scheme - #70525
Conversation
potiuk
left a comment
There was a problem hiding this comment.
I reviewed this alongside the four sibling ports (#70301 wasb, #70682 oss, #70549 stackdriver, #70295 opensearch), and this is the one that got the contentious question right.
All ten arguments match the legacy airflow_local_settings.py branch, and — the part that matters — it does not merge remote_task_handler_kwargs IO-kwargs. That is genuinely what legacy does for Elasticsearch, unlike the object-storage backends which apply | _io_kwargs. Recording the reasoning in the docstring rather than leaving it implicit is what makes the difference; #70295 hit the same fork and went the other way, and I have asked about it there.
One thing I checked closely: conf.get("elasticsearch", "host") or "http://localhost:9200" has no legacy counterpart, since legacy gated the whole branch on elif ELASTICSEARCH_HOST: and so could never reach construction with an empty host. Under scheme dispatch it can. The fallback turns out to be the class's own attrs default rather than a new value, and test_from_config_missing_host_keeps_class_default names precisely that, with a comment explaining that Elasticsearch("") would raise and silently disable remote logging. Good call to cover it.
The ProvidersManager test is worth having too — it verifies the provider.yaml registration actually resolves rather than just assuming the YAML is picked up, and the pytest.skip keeps it honest on cores without the dispatch mechanism.
Rebased onto main before merging.
Drafted-by: Claude Code (Opus 5); reviewed by @potiuk before posting
791de3d to
99390e8
Compare
closes: #70271
related: #70265
related: #67056
Migrates the Elasticsearch remote-logging backend to the provider dispatch mechanism: adds
ElasticsearchRemoteLogIO.from_config()and registers anelasticsearchscheme, so[logging] remote_base_log_folder = elasticsearch://routes through the provider.The legacy host-based selection still works via the fallback in
airflow_local_settings.py, so existing configs are unaffected.End-to-end verification
breeze start-airflow --integration elasticsearch,remote_base_log_folder = elasticsearch://, ran a task with remote logging enabled.Written to Elasticsearch:
Read back in the UI:
Was generative AI tooling used to co-author this PR?
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.