workflow: implement Run.terminate() - #396
Conversation
Write cancellation events with an optional reason and model the event so cancellation responses and stored events can be read.
dfe7a9c to
c8d33ca
Compare
msullivan
left a comment
There was a problem hiding this comment.
Hm; would it be possible to come up with a modified name for this?
Maybe it would be better if we kept cancel meaning python task cancellation; you could imagine us making it work on workflows runs too.
Feel free to ignore me and merge if you think that's ridiculous
Reuse UTF-16 code unit counting for cancellation reasons and attribute keys.
Yeah this makes sense; since TS is already using "abort" for interrupting steps cooperatively, I would rename this to "terminate" as in "kill workflow run from outside without cleanup". We still have a chance to rename before release if you found "terminate" a bad name too. |
Reserve cancel for future cooperative cancellation. Document that termination marks the run cancelled without delivering CancelledError to the workflow or its running steps.
Terminate sounds good to me. |
Add
await run.terminate()with an optionalreason, recorded as plaintext on arun_cancelledevent with a limit of 512 UTF-16 code units.This is the TS SDK's
Run.cancel(), renamed to reservecancel()for cooperative cancellation. We've been missing this one until I found it during docs work.