Skip to content
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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

amoghrajesh
Copy link
Contributor


^ 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.

Copy link
Member

@ashb ashb left a 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?
Copy link
Member

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

Copy link
Contributor Author

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

Copy link
Member

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))
Copy link
Member

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!

Copy link
Contributor Author

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)
Copy link
Member

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

Copy link
Contributor Author

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",
Copy link
Member

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
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants