Skip to content

client calling out to private method in KernelManager #1047

Open
@jgeraerts

Description

@jgeraerts

_async_is_alive calls out to _async_is_alive in the kernelmanager.

https://github.com/jupyter/jupyter_client/blob/main/jupyter_client/client.py#L415

    async def _async_is_alive(self) -> bool:
        """Is the kernel process still running?"""
        from .manager import KernelManager

        if isinstance(self.parent, KernelManager):
            # This KernelClient was created by a KernelManager,
            # we can ask the parent KernelManager:
            return await self.parent._async_is_alive()
        if self._hb_channel is not None:
            # We don't have access to the KernelManager,
            # so we use the heartbeat.
            return self._hb_channel.is_beating()
        # no heartbeat and not local, we can't tell if it's running,
        # so naively return True
        return True

However when using the GatewayKernelManager from jupyter_server this assertion fails https://github.com/jupyter/jupyter_client/blob/main/jupyter_client/manager.py#L696, while it has overridden the is_alive method

So I think _async_is_alive should be made public and the GatewayKernelManager should also be adapted to override this method.

What are your thoughts?

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