-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add cancellation loop to agent #7671
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
Conversation
d189892
to
c2a1221
Compare
e2bbe58
to
886f129
Compare
85000e5
to
b6728e9
Compare
f"Killing {infrastructure.type} {flow_run.infrastructure_pid} for flow run '{flow_run.id}'..." | ||
) | ||
try: | ||
await infrastructure.kill(flow_run.infrastructure_pid) |
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.
Should we handle the case that infrastructure_pid
is null?
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 let's handle that and do a hasattr
check for kill
.
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.
On second thought, we should maybe handle this during the proposal of a cancelled state? We can add a kill-infrastructure
capability to infrastructure blocks that support killing and block cancellation when it is not supported?
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.
That works for me. We do still have the, very small, edge case that infrastructure_pid
is null because the flow_run update failed. Checking that here probably still makes sense.
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 added these in 52f5565 and we mark the run as cancelled so we don't pick it up forever. Kind of an awkward situation.
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.
Left a couple small comments, otherwise lgtm!
9daea9a
to
11fe0a0
Compare
3cf384b
to
bf46e32
Compare
11fe0a0
to
39e2bc7
Compare
bf46e32
to
9a128a2
Compare
39e2bc7
to
e3caa3f
Compare
9a128a2
to
95e2bdc
Compare
e3caa3f
to
d5e6209
Compare
…cancelled_flow_runs`
# Conflicts: # src/prefect/agent.py
95e2bdc
to
bd98425
Compare
Example
Flow:
Trigger:
Agent:
Checklist
<link to issue>
"fix
,feature
,enhancement