-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Do not require dag_version_id in workload TI model #55717
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
Closed
ephraimbuddy
wants to merge
4
commits into
apache:main
from
astronomer:nullify-dagversion-in-ti-workloads
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
| from __future__ import annotations | ||
|
|
||
| import uuid | ||
|
|
||
| from airflow.executors.workloads import TaskInstance | ||
|
|
||
|
|
||
| def test_taskinstance_dag_version_id_is_optional_in_model_construction(): | ||
| # Should construct without providing dag_version_id | ||
| ti = TaskInstance( | ||
| id=uuid.uuid4(), | ||
| task_id="t1", | ||
| dag_id="d1", | ||
| run_id="r1", | ||
| try_number=1, | ||
| pool_slots=1, | ||
| queue="default", | ||
| priority_weight=1, | ||
| ) | ||
| assert getattr(ti, "dag_version_id", None) is None | ||
|
|
||
|
|
||
| def test_taskinstance_json_schema_marks_dag_version_id_as_nullable_optional(): | ||
| schema = TaskInstance.model_json_schema() | ||
|
|
||
| # Field should exist in properties | ||
| assert "dag_version_id" in schema["properties"], "dag_version_id should be present in properties" | ||
|
|
||
| # It should not be in required | ||
| assert "required" in schema | ||
| assert "dag_version_id" not in schema["required"], "dag_version_id should not be required" | ||
|
|
||
| # Validate the OpenAPI/JSON Schema for optional nullable uuid | ||
| dag_version_schema = schema["properties"]["dag_version_id"] | ||
|
|
||
| # pydantic v2 emits anyOf: [{type: string, format: uuid}, {type: 'null'}] | ||
| assert "anyOf" in dag_version_schema, "dag_version_id should be nullable (anyOf with null)" | ||
| any_of = dag_version_schema["anyOf"] | ||
| assert any(item.get("type") == "string" and item.get("format") == "uuid" for item in any_of), ( | ||
| "one variant must be uuid string" | ||
| ) | ||
| assert any(item.get("type") == "null" for item in any_of), "one variant must be null" |
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
34 changes: 17 additions & 17 deletions
34
providers/edge3/src/airflow/providers/edge3/plugins/www/dist/main.umd.cjs
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| 05e9a75c13c19b0018c43055b669b2db9ef0464c1f5179a20e34add6c59ad53b | ||
| e2cc56278007e2de0289d9dc6f22e2b5457ab65561431c18129973bd64f6c89c |
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.
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.
How can we execute a TI without a dag version? For it to be executed, doesn't it have to still exist, and this get reparsed to include a dag version?
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.
We can execute a TI without a dag_version since the RuntimeTaskInstance model doesn't include the dag_version_id:
airflow/task-sdk/src/airflow/sdk/execution_time/task_runner.py
Line 129 in 9bc58a2
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.
Isn't that dag_version_id the one that the (git, etc) dag bundle backend is told to checkout?
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.
Ah no, bundle_info is what the dag bundle info is.
I still wonder how it's actually possible to get to an executor with no dag_version set?
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.
No. dag bundle backend checks out dag bundle version:
airflow/airflow-core/src/airflow/models/dagbundle.py
Line 47 in 9bc58a2
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.
And it's more about the dagrun than task instance
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.
Still -- aren't "all" DagRuns in airflow 3 meant to have a version? What is the case by which we end up without a dag version but the task in the executor?
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.
I will experiment with this by reproducing this with a running TI
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.
Alternative to this that's less disruptive: #55884