xchwan commented on code in PR #75945:
URL: https://github.com/apache/airflow/pull/75945#discussion_r4705535285


##########
chart/templates/dag-processor/dag-processor-deployment.yaml:
##########
@@ -21,6 +21,37 @@
 ## Airflow Dag Processor Deployment
 #################################
 {{- if .Values.dagProcessor.enabled }}
+{{- $globals := deepCopy . -}}
+{{- $dagProcessorSets := .Values.dagProcessor.sets | default list -}}
+{{- $seenSetNames := dict -}}
+{{- range $dagProcessorSets -}}
+  {{- $setName := .name | default "" | toString -}}
+  {{- if eq $setName "default" -}}
+    {{- fail "`dagProcessor.sets` items cannot be named `default`; that name 
is used by the default Dag processor" -}}
+  {{- end -}}
+  {{- if not (and (regexMatch "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" $setName) (le 
(len $setName) 63)) -}}
+    {{- fail (printf "`dagProcessor.sets` item name %q is not a valid DNS-1123 
label (lowercase alphanumerics and '-', starting and ending with an 
alphanumeric, at most 63 characters)" $setName) -}}
+  {{- end -}}
+  {{- if hasKey $seenSetNames $setName -}}
+    {{- fail (printf "`dagProcessor.sets` contains the name %q more than once" 
$setName) -}}
+  {{- end -}}
+  {{- $_ := set $seenSetNames $setName true -}}
+{{- end -}}
+{{- $enableDefault := .Values.dagProcessor.enableDefault -}}
+{{- if kindIs "invalid" $enableDefault -}}
+  {{- $enableDefault = not .Values.dagProcessor.sets -}}

Review Comment:
   Documented in a new "Removing a Dag bundle" section of 
`manage-dag-files.rst`. After removing a
   bundle and its set, run `airflow dags reserialize --bundle-name <bundle>` 
once in the
   `dag-processor` container of a remaining set. It calls 
`sync_bundles_to_db()` with the full
   config, so bundles that are no longer configured are marked inactive. The 
alternative is to set
   `enableDefault: true` until the Dags are gone. The scheduler then marks the 
Dags stale
   (`cleanup_processor_metadata`, every `scheduler.parsing_cleanup_interval`).
   
   Checked on kind (sets-only, `set-a` → `bundle_a`, `set-b` → `bundle_b`,
   `parsing_cleanup_interval: 30`):
   
   | Step | `dag_bundle.active` (a / b) | `is_stale` (a / b) |
   |---|---|---|
   | Before | t / t | f / f |
   | 90s after removing `bundle_b` and `set-b` | t / t | f / f |
   | After `reserialize --bundle-name bundle_a` (exit 0) | t / f | f / f |
   | 90s later | t / f | f / t |
   
   The scheduler logged `Deactivating Dag because its bundle is no longer 
active bundle_name=bundle_b`.
   
   ---
   Drafted-by: Claude Code (Opus 5.5); reviewed by `xchwan` before posting
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to