orangeqs.juice.service.proxy#

Proxy kernel for OrangeQS Juice services.

Users of Juice are expected to work with the setup not from their own IPython kernel, but from the shared OrangeQS Juice service kernels. The proxy kernels are useful when a user or maintainer wants to execute raw IPython code in the context of a service, avoiding any API wrappers.

Proxy kernels can be installed using install_proxy_kernels() and are visible in Jupyter interface. The same step installs the personal kernel with install_personal_kernel(), which tells users that it has no shared hardware.

Module Contents#

Functions#

install_proxy_kernels

Install proxy kernels for all OrangeQS Juice services.

install_personal_kernel

Install the personal kernelspec in the current Python environment.

start_proxy_kernel

Start a proxy kernel for an OrangeQS Juice service.

Data#

PERSONAL_KERNEL_NAME

Name of the personal kernelspec. It overrides the stock ipykernel kernelspec.

PERSONAL_KERNEL_DISPLAY_NAME

Display name of the personal kernelspec.

API#

orangeqs.juice.service.proxy.PERSONAL_KERNEL_NAME#

‘python3’

Name of the personal kernelspec. It overrides the stock ipykernel kernelspec.

orangeqs.juice.service.proxy.PERSONAL_KERNEL_DISPLAY_NAME#

‘Personal Kernel’

Display name of the personal kernelspec.

orangeqs.juice.service.proxy.install_proxy_kernels() → None#

Install proxy kernels for all OrangeQS Juice services.

This also removes old proxy kernels of services that no longer exist.

orangeqs.juice.service.proxy.install_personal_kernel(kernel_spec_manager: jupyter_client.kernelspec.KernelSpecManager | None = None) → pathlib.Path#

Install the personal kernelspec in the current Python environment.

The kernelspec has the name python3, so it replaces the stock ipykernel kernelspec of the environment. Jupyter finds kernelspecs in the environment before the kernelspecs of the user, so a user install does not override it. It starts a normal IPython kernel that loads the orangeqs.juice.client._kernel_hint extension as an extra extension, so extensions from the IPython configuration still load. The extension tells the user that this kernel cannot reach the shared hardware.

Parameters#

  • kernel_spec_manager: Kernelspec manager to install with. Default is a new KernelSpecManager.

Returns#

  • (Path): Path to the folder of the installed kernelspec.

orangeqs.juice.service.proxy.start_proxy_kernel(service_name: str, connection_file: str, *, shared_hardware: bool = False) → None#

Start a proxy kernel for an OrangeQS Juice service.

Parameters#

  • service_name: Name of the OrangeQS Juice service to proxy requests to.

  • connection_file: Path to a kernel connection file for the proxy process itself. This file is provided by Jupyter when starting the proxy from the launcher.

  • shared_hardware: Whether the service can reach the shared hardware. This changes the note that the proxy shows to users.