Skip to content

Cross-actor cancel scopes? #122

@goodboy

Description

@goodboy

I was just trying to psuedo complete #36 for a collaborator and realized we don't have a way to cancel a task arbitrarily started from the calling actor.

This should be possible in theory by creating our own version of trio.CancelScope that is aware of tasks started by Portal.run(). I don't think anything more is needed other then that since ActorNursery.run_in_actor() main tasks should in theory be solo and cancelled when the actor terminates (which happens when the nursery exits).

One question is whether we should add a new 'cancel' message to the in-progress iac protocol.

Right now you can use the existing "rpc" mechanisms to call a cancel method on the remote Actor (specifically ._cancle_task()), but this is likely too tightly coupled to tractor's specific implementation in the case where we want to support other languages which can interact in an SC way with tractor systems using this same protocol.

Metadata

Metadata

Assignees

No one assigned

    Labels

    cancellationSC teardown semantics and anti-zombie semanticssupervision

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions