Skip to content

Add unique UUID try_id column to TaskInstance and TaskInstanceHistory#47065

Merged
ephraimbuddy merged 13 commits intoapache:mainfrom
astronomer:add-ti-try-id
Mar 5, 2025
Merged

Add unique UUID try_id column to TaskInstance and TaskInstanceHistory#47065
ephraimbuddy merged 13 commits intoapache:mainfrom
astronomer:add-ti-try-id

Conversation

@ephraimbuddy
Copy link
Contributor

This change introduces a new try_id UUID column that uniquely identifies each task instance attempt across both TaskInstance and TaskInstanceHistory tables.

  • Creates a unique identifier for each task execution attempt
  • Allows retrieving task instances or history with a single key
  • Maintains try_id uniqueness when tasks are retried or cleared
  • Adds necessary database migration for adding the columns and constraints
  • Updates relevant task instance functions to generate new try_ids when tasks are retried

Tested manually and unittest to see that the behaviour works well.

Closes: #47015, Closes: #43437

@ephraimbuddy ephraimbuddy force-pushed the add-ti-try-id branch 8 times, most recently from 5e93551 to 7dcdac4 Compare March 3, 2025 08:01
@ephraimbuddy ephraimbuddy requested a review from ashb March 3, 2025 10:55
This change introduces a new `try_id` UUID column that uniquely identifies each
task instance attempt across both TaskInstance and TaskInstanceHistory tables.

- Creates a unique identifier for each task execution attempt
- Allows retrieving task instances or history with a single key
- Maintains try_id uniqueness when tasks are retried or cleared
- Adds necessary database migration for adding the columns and constraints
- Updates relevant task instance functions to generate new try_ids when tasks are retried

Tested manually and unittest to see that the behaviour works well.
@ephraimbuddy ephraimbuddy merged commit 3a87490 into apache:main Mar 5, 2025
43 checks passed
@ephraimbuddy ephraimbuddy deleted the add-ti-try-id branch March 5, 2025 08:11
shahar1 pushed a commit to shahar1/airflow that referenced this pull request Mar 5, 2025
…ry (apache#47065)

* Add unique UUID `try_id` column to TaskInstance and TaskInstanceHistory

This change introduces a new `try_id` UUID column that uniquely identifies each
task instance attempt across both TaskInstance and TaskInstanceHistory tables.

- Creates a unique identifier for each task execution attempt
- Allows retrieving task instances or history with a single key
- Maintains try_id uniqueness when tasks are retried or cleared
- Adds necessary database migration for adding the columns and constraints
- Updates relevant task instance functions to generate new try_ids when tasks are retried

Tested manually and unittest to see that the behaviour works well.

* Make try_id a primary key of task_instance_history table

* fixup! Make try_id a primary key of task_instance_history table

* fixup! fixup! Make try_id a primary key of task_instance_history table

* fixup! fixup! fixup! Make try_id a primary key of task_instance_history table

* fixup! fixup! fixup! fixup! Make try_id a primary key of task_instance_history table

* Update task_instance_history_orm

* fixup! Update task_instance_history_orm

* fixup! fixup! Update task_instance_history_orm

* fix test

* improve test query

* fixup! improve test query

* fixup! fixup! improve test query
nailo2c pushed a commit to nailo2c/airflow that referenced this pull request Apr 4, 2025
…ry (apache#47065)

* Add unique UUID `try_id` column to TaskInstance and TaskInstanceHistory

This change introduces a new `try_id` UUID column that uniquely identifies each
task instance attempt across both TaskInstance and TaskInstanceHistory tables.

- Creates a unique identifier for each task execution attempt
- Allows retrieving task instances or history with a single key
- Maintains try_id uniqueness when tasks are retried or cleared
- Adds necessary database migration for adding the columns and constraints
- Updates relevant task instance functions to generate new try_ids when tasks are retried

Tested manually and unittest to see that the behaviour works well.

* Make try_id a primary key of task_instance_history table

* fixup! Make try_id a primary key of task_instance_history table

* fixup! fixup! Make try_id a primary key of task_instance_history table

* fixup! fixup! fixup! Make try_id a primary key of task_instance_history table

* fixup! fixup! fixup! fixup! Make try_id a primary key of task_instance_history table

* Update task_instance_history_orm

* fixup! Update task_instance_history_orm

* fixup! fixup! Update task_instance_history_orm

* fix test

* improve test query

* fixup! improve test query

* fixup! fixup! improve test query
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:db-migrations PRs with DB migration area:task-execution-interface-aip72 AIP-72: Task Execution Interface (TEI) aka Task SDK kind:documentation

Development

Successfully merging this pull request may close these issues.

Evaluate if the TI History table requires similar updates (TI pk) for UUID v7 compatibility

4 participants