jason810496 commented on code in PR #63185:
URL: https://github.com/apache/airflow/pull/63185#discussion_r2905681464
##########
airflow-core/src/airflow/migrations/versions/0082_3_1_0_make_bundle_name_not_nullable.py:
##########
@@ -43,63 +43,62 @@
def upgrade():
"""Make bundle_name not nullable."""
+ import contextlib
+
+ # We need the DagBundlesManager here to respect and validate the user
configured bundles instead of hardcoding 'dags-folder' and 'example_dags' as
the only two bundles.
+ from airflow.dag_processing.bundles.manager import DagBundlesManager
Review Comment:
The main problem here is that the Dags without `bundle_name` will be set to
`dag-folder` dag bundle name during migration.
> We can't really do this -- we generally can't reliably use config settings
at migration time.
However, the incedent happend right after the 2 to 3 upgrade, and even if
user trigger the DagRun after the upgrade, they still encounter the `Requested
bundle '{name}' is not configured.` error.
> could we handle this in DagBundlesManager.sync_bundles_to_db() instead?
Do you mean move the batch update statement (`UPDATE dag SET bundle_name =
:default_bundle WHERE bundle_name IS NULL`) from migration script to
`DagBundlesManager.sync_bundles_to_db`?
The migration will enforce the `nullable=False` constraint, so it _seems_ we
could only fix in the migration script.
--
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]