Skip to content

AIP-72: Handle External update TI state in Supervisor - #44406

Merged
kaxil merged 2 commits into
apache:mainfrom
astronomer:handle-state-conflict-on-heartbeat
Nov 28, 2024
Merged

kaxil merged 2 commits into
apache:mainfrom
astronomer:handle-state-conflict-on-heartbeat

Conversation

@kaxil

@kaxil kaxil commented Nov 27, 2024 •

Copy link
Copy Markdown
Member
  • Updated logic to handle externally updated TI state in Supervisor. This states could have been externally changed via UI, CLI, API etc
  • Replaced FASTEST_HEARTBEAT_INTERVAL and SLOWEST_HEARTBEAT_INTERVAL with MIN_HEARTBEAT_INTERVAL and HEARTBEAT_THRESHOLD for better clarity

This is part of my efforts to port LocalTaskJob tests to Supervisor: #44356.

This ports over TestLocalTaskJob.test_mark_{success,failure}_no_kill.

This PR also allows retrying heartbeats:

  • Added _last_successful_heartbeat and _last_heartbeat_attempt for better separation of tracking successful heartbeats and retries.
  • MIN_HEARTBEAT_INTERVAL is now respected between heartbeat attempts, even after failures.
  • The num of retries is configurable via MAX_FAILED_HEARTBEATS

^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
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 newsfragments.

@kaxil kaxil added the area:task-execution-interface-aip72 AIP-72: Task Execution Interface (TEI) aka Task SDK label Nov 27, 2024
@kaxil
kaxil requested a review from ashb November 27, 2024 01:47
@kaxil
kaxil force-pushed the handle-state-conflict-on-heartbeat branch 2 times, most recently from 3b5e851 to 7618dd6 Compare November 27, 2024 11:27
@kaxil
kaxil force-pushed the handle-state-conflict-on-heartbeat branch 8 times, most recently from c64aa59 to 3e54c51 Compare November 28, 2024 16:47
@kaxil
kaxil force-pushed the handle-state-conflict-on-heartbeat branch 3 times, most recently from f51f3b3 to 6e7ed67 Compare November 28, 2024 18:32

@ashb ashb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few nits, LGTM!

- Updated logic to handle externally updated TI state in Supervisor. This states could have been externally changed via UI, CLI, API etc
- Replaced `FASTEST_HEARTBEAT_INTERVAL` and `SLOWEST_HEARTBEAT_INTERVAL` with `MIN_HEARTBEAT_INTERVAL` and `HEARTBEAT_THRESHOLD` for better clarity

This is part of my efforts to port LocalTaskJob tests to Supervisor: apache#44356.

This ports over `TestLocalTaskJob.test_mark_{success,failure}_no_kill`.

This PR also allows retrying heartbeats:

- Added `_last_successful_heartbeat` and `_last_heartbeat_attempt` for better separation of tracking successful heartbeats and retries.
- `MIN_HEARTBEAT_INTERVAL` is now respected between heartbeat attempts, even after failures.
-  The num of retries is configurable via `MAX_FAILED_HEARTBEATS`
@kaxil
kaxil force-pushed the handle-state-conflict-on-heartbeat branch from 6e7ed67 to 0666a6c Compare November 28, 2024 22:12
@kaxil
kaxil merged commit 6e3a25e into apache:main Nov 28, 2024
@kaxil
kaxil deleted the handle-state-conflict-on-heartbeat branch November 28, 2024 23:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:task-execution-interface-aip72 AIP-72: Task Execution Interface (TEI) aka Task SDK area:task-sdk

Projects

No open projects

Development

Successfully merging this pull request may close these issues.

2 participants