Skip to content

Enable provider-based GCS remote logging resolution - #70504

Merged
shahar1 merged 1 commit into
apache:mainfrom
aaron-y-chen:enable-gcs-provider-remote-logging-resolution
Jul 27, 2026
Merged

Enable provider-based GCS remote logging resolution#70504
shahar1 merged 1 commit into
apache:mainfrom
aaron-y-chen:enable-gcs-provider-remote-logging-resolution

Conversation

@aaron-y-chen

Copy link
Copy Markdown
Contributor

closes: #70266
related: #70265
related: #67056

Summary

Migrate the gs remote logging scheme to the provider dispatch introduced by #67056:

  • add GCSRemoteLogIO.from_config(), preserving the legacy GCS config mapping and IO kwargs;
  • register gs in the Google provider metadata generated from provider.yaml.

Core and the Task SDK can now resolve GCS logging through ProvidersManager. The existing legacy path remains as a compatibility fallback.

Validation

Tested against a real GCS bucket from Breeze using forwarded user ADC and:

remote_logging = True
remote_base_log_folder = gs://airflow-70266-<random>/airflow-70266
delete_local_logs = True

No remote_log_conn_id or google_key_path was set, so the handler used ADC.

  • gs resolved to airflow.providers.google.cloud.log.gcs_task_handler.GCSRemoteLogIO;
  • the task emitted AIRFLOW_70266_GCS_REMOTE_LOG_E2E_OK, and gcloud storage cat returned the same marker from attempt=1.log;
  • the corresponding local log no longer existed after upload;
  • the Airflow UI reported the gs://.../attempt=1.log source and displayed the marker.

Airflow UI reading the task log from GCS after local cleanup:

70266_1

The uploaded attempt=1.log in the real GCS bucket:

70266_2
Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Generated-by: [GPT 5.6 Sol] following the guidelines

@boring-cyborg boring-cyborg Bot added area:logging area:providers provider:google Google (including GCP) related issues labels Jul 27, 2026
@aaron-y-chen
aaron-y-chen marked this pull request as ready for review July 27, 2026 09:56
@aaron-y-chen
aaron-y-chen requested a review from shahar1 as a code owner July 27, 2026 09:56

@shahar1 shahar1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — a faithful port of the gs scheme onto the #67056 dispatch, matching the merged s3 (#69817) and cloudwatch (#69816) migrations line for line, with real-backend e2e evidence in the description. CI is green.

What I checked beyond the diff itself:

  • Config parity with the legacy branch. from_config() reproduces airflow_local_settings.py L207–L224 exactly — same four keys, expanduser on base_log_folder, google_key_pathgcp_key_path, and the same | io_kwargs merge order. Existing gs:// configs resolve to an identical GCSRemoteLogIO.
  • google_key_path unset (ADC) doesn't trip get_mandatory_value. [logging] google_key_path defaults to "" rather than None in config.yml, so the mandatory getter returns a falsy string instead of raising — same as the legacy path, and consistent with the ADC-only run in your description.
  • Dropping the derived default conn id is fine. The legacy branch called _default_conn_name_from(..., "GCSHook"); provider dispatch deliberately doesn't (factory.py: "Provider dispatch does not produce a default conn id … providers that want a backend-specific default can read from their own hook inside from_config"). GCSRemoteLogIO.hook already reads [logging] remote_log_conn_id itself and falls back to ADC, and the supervisor's _remote_logging_conn prefetch only fires when that key is explicitly set — so no behaviour change, and it matches what #69817 shipped.
  • Backward compatibility of the new provider.yaml key. provider_info.schema.json does not set additionalProperties: false in 2.11.1 (or on main), so the remote-logging block is ignored rather than rejected on older Airflow. The Compat 2.11.1 / 3.0.6 / 3.1.8 / 3.2.2 / 3.3.0 jobs confirm it.
  • The test guards earn their keep. The hasattr(manager, "remote_logging_handler_by_scheme") skip and pytest.importorskip("airflow._shared.logging.factory") read as defensive at first glance, but they're exactly what lets this class run under the provider-compat jobs against Airflow versions predating #67056.

Smaller observations

  • providers/google/src/airflow/providers/google/cloud/log/gcs_task_handler.py — this makes three verbatim copies of the ~18-line remote_task_handler_kwargs parse-and-split block (s3, cloudwatch, now gcs), with several backends still to migrate under #70265. Factoring it out is awkward while providers still support Airflow 2.11 — airflow._shared.logging.factory isn't importable there — so I'd leave this PR as-is and raise the dedup question on the umbrella issue instead. Purely a note, not a change request.

This review was drafted by an AI-assisted tool and
confirmed by an Apache Airflow maintainer. The maintainer
approving this PR has read the findings and signed off. If
something feels off, please reply on the PR and a maintainer
will follow up.

More on how Apache Airflow handles maintainer review:
contributing-docs/05_pull_requests.rst.

@shahar1
shahar1 merged commit 8216231 into apache:main Jul 27, 2026
167 checks passed
@aaron-y-chen

Copy link
Copy Markdown
Contributor Author

Thanks shahar! 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:logging area:providers provider:google Google (including GCP) related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add GCSRemoteLogIO.from_config and register gs remote logging scheme

2 participants