-
Notifications
You must be signed in to change notification settings - Fork 15.4k
make bundle_name not nullable #47592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
remove migration query Co-authored-by: Ephraim Anierobi <splendidzigy24@gmail.com>
Hi @ephraimbuddy @jedcunningham Do you think this PR looks good already, or you think more testing needs to be done? |
Since Airflow 3 has been released, we should update the PR with new migration file instead of editing the add-dagbundlemodel migration file. Sorry that it didn't make it to 3.0.0 |
PR is updated to use new migration file, as 3.0 is rolled out. |
airflow-core/src/airflow/migrations/versions/0069_3_1_0_make_bundle_name_not_nullable.py
Outdated
Show resolved
Hide resolved
…undle_name_not_nullable.py Co-authored-by: Ephraim Anierobi <splendidzigy24@gmail.com>
airflow-core/src/airflow/migrations/versions/0069_3_1_0_make_bundle_name_not_nullable.py
Outdated
Show resolved
Hide resolved
…undle_name_not_nullable.py Update downgrade Co-authored-by: Ephraim Anierobi <splendidzigy24@gmail.com>
@jedcunningham @eladkal Conflict is resolved, could you please review again? Thanks! |
providers/cncf/kubernetes/tests/unit/cncf/kubernetes/operators/test_job.py
Outdated
Show resolved
Hide resolved
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_backfills.py
Show resolved
Hide resolved
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_warning.py
Outdated
Show resolved
Hide resolved
Hi @jedcunningham, PR updated. All test functions now add dag bundle with fixture. For adding dag bundle in helper functions, |
airflow-core/src/airflow/migrations/versions/0079_3_1_0_make_bundle_name_not_nullable.py
Outdated
Show resolved
Hide resolved
dag_id = "dag_with_queued_run" | ||
|
||
# Create DagModel | ||
dag_model = DagModel( | ||
dag_id=dag_id, | ||
bundle_name="testing", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would testing_dag_bundle.name
be better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That fixture doesnt return the model, but it could. My 2c, we have so much of this pattern already, keeping consistent and refactoring separately, if we wanted to, would be the way to go.
if AIRFLOW_V_3_0_PLUS: | ||
clear_db_dag_bundles() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should use AIRFLOW_V_3_1_PLUS instead (since 3.0.x would not have this function)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By checking the function definition and the migration file of DagBundle, I think the function and the model exist with 3.0.x.
Actually, AIRFLOW_V_3_0_PLUG is used as the condition for clear_db_dag_bundles
in other places as well, like here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these fixtures no longer class scoped?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is because function scope fixture testing_dag_bundle
is used here. If they are class scoped, it will raise error ScopeMismatch: You tried to access the function scoped fixture testing_dag_bundle with a class scoped request object.
I think switching to function scoped is easier, compared to creating bundle with DagBundleModel
.
Change bundle_name in dag not nullable and prepopulate the value in the migration: #46734
Closes: #46734