jason810496 opened a new pull request, #63185:
URL: https://github.com/apache/airflow/pull/63185

   
   * related: #47592
   
   ## Why
   
   If user configure the Dag Bundle with other name than `dags-folder` when 
running the `Make bundle_name not nullable` migration, which might raise the 
following `"Requested bundle '{name}' is not configured."` error:
   
   
https://github.com/apache/airflow/blob/450a08e78499fbd6d21d2d6dc2392dff9dbfda98/airflow-core/src/airflow/dag_processing/bundles/manager.py#L333-L345
   
   
   There're also some other edge case that will cause the above error:  
   
   **case 1**: Dag Bundle name not `dags-folder`
   
   ```bash
   AIRFLOW__DAG_PROCESSOR__DAG_BUNDLE_CONFIG_LIST='[{"name": "main", 
"classpath": "airflow.dag_processing.bundles.local.LocalDagBundle", "kwargs": 
{"path": "/files/dags", "refresh_interval": 1}}]'
   ```
   
   **case 2**: Multiple Custom Dag Bundle
   
   ```bash
   AIRFLOW__DAG_PROCESSOR__DAG_BUNDLE_CONFIG_LIST='[{"name": "main1", 
"classpath": "airflow.dag_processing.bundles.local.LocalDagBundle", "kwargs": 
{"path": "/files/dags", "refresh_interval": 1}},  {"name": "main2", 
"classpath": "airflow.dag_processing.bundles.local.LocalDagBundle", "kwargs": 
{"path": "/files/dags", "refresh_interval": 1}}]'
   ```
   
   The migration script will only insert `dag-folder` bundle instead of the 
correct Dag bundle before the fix for all the above cases.
   
   ## What
   
   The migration script should respect the user configured dag bundle list 
instead of relying one the the hard-coded `dag-folder` with the 
`%/airflow/example_dags/%` if / else case.
   
   To avoid the following main root cause before the patch:
   ```python
   text(
       """
       UPDATE dag
       SET bundle_name =
           CASE
               WHEN fileloc LIKE '%/airflow/example_dags/%' THEN 'example_dags'
               ELSE 'dags-folder'
           END
       WHERE bundle_name IS NULL
       """
   )
   ```
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   
   - [x] Yes (please specify the tool below) Claude Code for adding unit tests
   


-- 
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