-
Notifications
You must be signed in to change notification settings - Fork 16.1k
Better error handling for running ti heartbeats after task is cleared #56443
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?
Changes from all commits
7e5ea0c
607574a
80542b5
32f289c
7341091
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -577,7 +577,7 @@ def ti_skip_downstream( | |
| "/{task_instance_id}/heartbeat", | ||
| status_code=status.HTTP_204_NO_CONTENT, | ||
| responses={ | ||
| status.HTTP_404_NOT_FOUND: {"description": "Task Instance not found"}, | ||
| status.HTTP_410_GONE: {"description": "Task Instance no longer exists, it may have moved to the Task Instance History table"}, | ||
| status.HTTP_409_CONFLICT: { | ||
| "description": "The TI attempting to heartbeat should be terminated for the given reason" | ||
| }, | ||
|
|
@@ -605,12 +605,12 @@ def ti_heartbeat( | |
| "Retrieved current task state", state=previous_state, current_hostname=hostname, current_pid=pid | ||
| ) | ||
| except NoResultFound: | ||
| log.error("Task Instance not found") | ||
| status.HTTP_410_GONE: {"description": "Task Instance no longer exists, it may have moved to the Task Instance History table"}, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is added here by mistake?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should actually validate that, check if it is present in the TIH table. Two situations possible here:
|
||
| raise HTTPException( | ||
| status_code=status.HTTP_404_NOT_FOUND, | ||
| status_code=status.HTTP_410_GONE, | ||
| detail={ | ||
| "reason": "not_found", | ||
| "message": "Task Instance not found", | ||
| status.HTTP_410_GONE: {"description": "Task Instance no longer exists, it may have moved to the Task Instance History table"}, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Formatting looks off -- static checks will fail |
||
| }, | ||
| ) | ||
|
|
||
|
|
||
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 think 404 should still exist, there’s a difference between a ti that never existed and a ti that existed but is gone.