Skip to content

AsyncKernelClient.is_alive() returns non-awaited coroutine? #621

@davidbrochart

Description

@davidbrochart

async is_alive() can return:

  1. an awaited coroutine if it was created by an AsyncKernelManager.
  2. or its parent's is_alive() if it was created by a KernelManager which is not AsyncKernelManager.
  3. or the heartbeat's is_beating() if we don't have access to the kernel manager that created it but we have a heartbeat.
  4. or True if we don't even have a heartbeat.

Cases 1. and 4. are fine, but 2. and 3. could potentially return a non-awaited coroutine. This is causing problems e.g. in jupyter/nbclient#138, but I think the main issue is that we don't know the objects that we are manipulating any more, because we are trying to have a single code base that works for async and non-async. I also think that we are allowing for too much freedom, for instance mixing a non async kernel manager and an async kernel client. This is becoming too complicated.
I think adding type annotations, as @MSeal suggested in #553, will help us understand and improve the situation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions