-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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
AIP 72: Handling deferrable tasks in execution API as well as TASK SDK #44241
base: main
Are you sure you want to change the base?
Conversation
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.
A good start!
next_method: str | ||
# need to serialise to datetime.timedelta | ||
timeout: str | None | ||
# what about triggerer_id? |
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.
This gets set in the db once the API processes the request, so it shouldn't/can't be part of the request
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.
The trigger_id right? I need to remove this comment then
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.
Yeah
timeout = ti_patch_payload.timeout | ||
# Calculate timeout too if it was passed | ||
if timeout is not None: | ||
ti.trigger_timeout = timezone.utcnow() + timedelta(days=int(timeout)) |
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.
Timeout shouldn't be days!
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 need to handle it better based on what I can send from the client, this isn't right yet
else: | ||
ti.trigger_timeout = ti.start_date + execution_timeout | ||
|
||
session.merge(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.
Merge isn't needed - the object is already attached to the session
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.
Commit only will do, right?
"state": "deferred", | ||
"classpath": "my-class-path", | ||
"kwargs": {}, | ||
"created_date": "2024-10-31T12:00:00Z", |
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.
Hmm, why is this being sent in the payload? Should it be the time the server received the request instead?
Co-authored-by: Ash Berlin-Taylor <ash_github@firemirror.com>
@@ -105,7 +132,7 @@ class TIHeartbeatInfo(BaseModel): | |||
class TaskInstance(BaseModel): | |||
"""Schema for TaskInstance model with minimal required fields needed for Runtime.""" | |||
|
|||
id: uuid.UUID | |||
id: uuid.UUID | int = 0 |
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.
This can't be 0
^ 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.