fix(providers/google): sanitize Dataproc batch labels to use dashes instead of underscores - #62926
Merged
Merged
Conversation
YoannAbriel
force-pushed
the
fix/issue-59332
branch
6 times, most recently
from
March 5, 2026 20:03
9cd8af9 to
05571b3
Compare
…nstead of underscores GCP labels only allow lowercase letters, numbers, and dashes. `__update_batch_labels` was replacing dots/spaces with underscores, causing InvalidArgument errors when DAG/task IDs contained underscores (e.g. task groups with dots in their path). Also fixes the validation regex to match GCP's actual label requirements and corrects the dag_display_name validation check which was incorrectly testing dag_id instead. Closes: apache#59332
YoannAbriel
force-pushed
the
fix/issue-59332
branch
from
March 8, 2026 19:06
752f36f to
8c0036e
Compare
potiuk
approved these changes
Mar 12, 2026
PascalEgn
pushed a commit
to PascalEgn/airflow
that referenced
this pull request
Mar 12, 2026
…nstead of underscores (apache#62926) * fix(providers/google): sanitize Dataproc batch labels to use dashes instead of underscores GCP labels only allow lowercase letters, numbers, and dashes. `__update_batch_labels` was replacing dots/spaces with underscores, causing InvalidArgument errors when DAG/task IDs contained underscores (e.g. task groups with dots in their path). Also fixes the validation regex to match GCP's actual label requirements and corrects the dag_display_name validation check which was incorrectly testing dag_id instead. Closes: apache#59332 * fix: use valid dag_id in test (no spaces allowed) * fix: apply ruff format
Pyasma
pushed a commit
to Pyasma/airflow
that referenced
this pull request
Mar 13, 2026
…nstead of underscores (apache#62926) * fix(providers/google): sanitize Dataproc batch labels to use dashes instead of underscores GCP labels only allow lowercase letters, numbers, and dashes. `__update_batch_labels` was replacing dots/spaces with underscores, causing InvalidArgument errors when DAG/task IDs contained underscores (e.g. task groups with dots in their path). Also fixes the validation regex to match GCP's actual label requirements and corrects the dag_display_name validation check which was incorrectly testing dag_id instead. Closes: apache#59332 * fix: use valid dag_id in test (no spaces allowed) * fix: apply ruff format
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
DataprocCreateBatchOperator.__update_batch_labels()replaces dots and spaces with underscores when building GCP labels from DAG/task IDs. GCP labels only allow lowercase letters, numbers, and dashes — underscores are invalid. This causesInvalidArgumenterrors when task IDs contain underscores (common with task groups, e.g.process_data).Root Cause
re.sub(r"[.\s]", "_", ...)only strips dots and whitespace, converting them to underscores. Any existing underscores in the ID pass through unchanged. The validation regexr"^[a-z][\w-]{0,62}$"also incorrectly allows underscores via\w.Additionally, the
dag_display_namevalidation was checkingdag_idinstead of the actualdag_display_namevalue.Fix
re.sub(r"[^a-z0-9-]", "-", ...)— strips everything except valid label charactersr"^[a-z0-9][a-z0-9-]{0,62}$"matching GCP's actual requirementsdag_display_namevalidation to check the right variableCloses: #59332
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code following the guidelines