You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "ashb (via GitHub)" <gi...@apache.org> on 2025/04/03 15:03:08 UTC
[PR] Remove/undo the `try_id`+`id` on TaskInstance table. [airflow]
ashb opened a new pull request, #48749:
URL: https://github.com/apache/airflow/pull/48749
<!--
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.
-->
<!--
Thank you for contributing! Please make sure that your code changes
are covered with tests. And in case of new features or big changes
remember to adjust the documentation.
Feel free to ping committers for the review!
In case of an existing issue, reference it using one of the following:
closes: #ISSUE
related: #ISSUE
How to write a good git commit message:
http://chris.beams.io/posts/git-commit/
-->
<!-- Please keep an empty line above the dashes. -->
---
**^ Add meaningful description above**
Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information.
In case of fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
In case of backwards incompatible changes please leave a note in a newsfragment file, named `{pr_number}.significant.rst` or `{issue_number}.significant.rst`, in [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Ensure that TI.id is unique per try. [airflow]
Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on code in PR #48749:
URL: https://github.com/apache/airflow/pull/48749#discussion_r2037197443
##########
airflow-core/tests/unit/api_fastapi/execution_api/versions/head/test_task_instances.py:
##########
@@ -1222,37 +1222,6 @@ def test_get_start_date_not_found(self, client):
response = client.get(f"/execution/task-reschedules/{ti_id}/start_date")
assert response.json() is None
- def test_get_start_date_with_try_number(self, client, session, create_task_instance):
Review Comment:
It's not possible to get this data for anything other than the current try number as we delete the old try data in `TI.prepare_db_for_next_try`.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Ensure that TI.id is unique per try. [airflow]
Posted by "kaxil (via GitHub)" <gi...@apache.org>.
kaxil merged PR #48749:
URL: https://github.com/apache/airflow/pull/48749
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Remove/undo the `try_id`+`id` on TaskInstance table. [airflow]
Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on PR #48749:
URL: https://github.com/apache/airflow/pull/48749#issuecomment-2792116028
Needs a pr desc etc, but I want to see 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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Remove/undo the `try_id`+`id` on TaskInstance table. [airflow]
Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on code in PR #48749:
URL: https://github.com/apache/airflow/pull/48749#discussion_r2035329872
##########
airflow-core/src/airflow/migrations/versions/0067_3_0_0_change_ti_table_to_have_.py:
##########
@@ -0,0 +1,99 @@
+#
Review Comment:
oh yeah, alembic truncated the message.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Remove/undo the `try_id`+`id` on TaskInstance table. [airflow]
Posted by "kaxil (via GitHub)" <gi...@apache.org>.
kaxil commented on code in PR #48749:
URL: https://github.com/apache/airflow/pull/48749#discussion_r2037156291
##########
airflow-core/src/airflow/api_fastapi/execution_api/routes/task_instances.py:
##########
@@ -313,9 +313,9 @@ def ti_update_state(
from airflow.models.taskinstancehistory import TaskInstanceHistory
ti = session.get(TI, ti_id_str)
- TaskInstanceHistory.record_ti(ti, session=session)
- ti.try_id = uuid7()
updated_state = ti_patch_payload.state
+ TaskInstanceHistory.record_ti(ti, session=session)
+ ti.id = uuid7()
Review Comment:
can just do: `ti.prepare_db_for_next_try()`
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Remove/undo the `try_id`+`id` on TaskInstance table. [airflow]
Posted by "amoghrajesh (via GitHub)" <gi...@apache.org>.
amoghrajesh commented on code in PR #48749:
URL: https://github.com/apache/airflow/pull/48749#discussion_r2035305597
##########
airflow-core/src/airflow/migrations/versions/0067_3_0_0_change_ti_table_to_have_.py:
##########
@@ -0,0 +1,99 @@
+#
Review Comment:
Incomplete file name?
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Ensure that TI.id is unique per try. [airflow]
Posted by "kaxil (via GitHub)" <gi...@apache.org>.
kaxil commented on code in PR #48749:
URL: https://github.com/apache/airflow/pull/48749#discussion_r2037201065
##########
airflow-core/tests/unit/api_fastapi/execution_api/versions/head/test_task_instances.py:
##########
@@ -1222,37 +1222,6 @@ def test_get_start_date_not_found(self, client):
response = client.get(f"/execution/task-reschedules/{ti_id}/start_date")
assert response.json() is None
- def test_get_start_date_with_try_number(self, client, session, create_task_instance):
Review Comment:
aah yeah we have other tests in TestGetRescheduleStartDate, sg
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Remove/undo the `try_id`+`id` on TaskInstance table. [airflow]
Posted by "kaxil (via GitHub)" <gi...@apache.org>.
kaxil commented on code in PR #48749:
URL: https://github.com/apache/airflow/pull/48749#discussion_r2037160862
##########
providers/standard/tests/unit/standard/operators/test_python.py:
##########
@@ -480,6 +480,7 @@ def f():
branch_ti.set_state(TaskInstanceState.SUCCESS, session=session)
dr.task_instance_scheduling_decisions(session=session)
branch_2_ti = dr.get_task_instance(task_id="branch_2", session=session)
+ branch_2_ti.task = self.branch_2
Review Comment:
What changed here? Why do we need to assign task again?
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Ensure that TI.id is unique per try. [airflow]
Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on code in PR #48749:
URL: https://github.com/apache/airflow/pull/48749#discussion_r2037198018
##########
airflow-core/src/airflow/migrations/versions/0041_3_0_0_rename_dataset_as_asset.py:
##########
@@ -155,7 +155,8 @@ def upgrade():
)
with op.batch_alter_table("asset_alias_asset", schema=None) as batch_op:
- batch_op.drop_constraint(op.f("dataset_alias_dataset_alias_id_fkey"), type_="foreignkey")
+ if op.get_bind().dialect.name != "sqlite":
+ batch_op.drop_constraint(op.f("dataset_alias_dataset_alias_id_fkey"), type_="foreignkey")
Review Comment:
I.... didn't mean to change this.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Ensure that TI.id is unique per try. [airflow]
Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on code in PR #48749:
URL: https://github.com/apache/airflow/pull/48749#discussion_r2037195746
##########
providers/standard/tests/unit/standard/operators/test_python.py:
##########
@@ -480,6 +480,7 @@ def f():
branch_ti.set_state(TaskInstanceState.SUCCESS, session=session)
dr.task_instance_scheduling_decisions(session=session)
branch_2_ti = dr.get_task_instance(task_id="branch_2", session=session)
+ branch_2_ti.task = self.branch_2
Review Comment:
Something changed in the session handling, so it lost the property. It's just a quirk in the 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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Remove/undo the `try_id`+`id` on TaskInstance table. [airflow]
Posted by "kaxil (via GitHub)" <gi...@apache.org>.
kaxil commented on code in PR #48749:
URL: https://github.com/apache/airflow/pull/48749#discussion_r2037159295
##########
airflow-core/tests/unit/api_fastapi/execution_api/versions/head/test_task_instances.py:
##########
@@ -1222,37 +1222,6 @@ def test_get_start_date_not_found(self, client):
response = client.get(f"/execution/task-reschedules/{ti_id}/start_date")
assert response.json() is None
- def test_get_start_date_with_try_number(self, client, session, create_task_instance):
Review Comment:
We should keep this test -- although probably in `airflow-core/tests/unit/api_fastapi/execution_api/versions/head/test_task_reschedules.py`
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Ensure that TI.id is unique per try. [airflow]
Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on code in PR #48749:
URL: https://github.com/apache/airflow/pull/48749#discussion_r2037198642
##########
airflow-core/src/airflow/migrations/versions/0041_3_0_0_rename_dataset_as_asset.py:
##########
@@ -155,7 +155,8 @@ def upgrade():
)
with op.batch_alter_table("asset_alias_asset", schema=None) as batch_op:
- batch_op.drop_constraint(op.f("dataset_alias_dataset_alias_id_fkey"), type_="foreignkey")
+ if op.get_bind().dialect.name != "sqlite":
+ batch_op.drop_constraint(op.f("dataset_alias_dataset_alias_id_fkey"), type_="foreignkey")
Review Comment:
```suggestion
batch_op.drop_constraint(op.f("dataset_alias_dataset_alias_id_fkey"), type_="foreignkey")
```
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Ensure that TI.id is unique per try. [airflow]
Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on code in PR #48749:
URL: https://github.com/apache/airflow/pull/48749#discussion_r2037194123
##########
airflow-core/src/airflow/api_fastapi/execution_api/routes/task_instances.py:
##########
@@ -313,9 +313,9 @@ def ti_update_state(
from airflow.models.taskinstancehistory import TaskInstanceHistory
ti = session.get(TI, ti_id_str)
- TaskInstanceHistory.record_ti(ti, session=session)
- ti.try_id = uuid7()
updated_state = ti_patch_payload.state
+ TaskInstanceHistory.record_ti(ti, session=session)
+ ti.id = uuid7()
Review Comment:
Yup good catch.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org