airflow.providers.papermill.hooks.kernel

属性

JUPYTER_KERNEL_SHELL_PORT

JUPYTER_KERNEL_IOPUB_PORT

JUPYTER_KERNEL_STDIN_PORT

JUPYTER_KERNEL_CONTROL_PORT

JUPYTER_KERNEL_HB_PORT

REMOTE_KERNEL_ENGINE

KernelConnection

表示内核连接对象的类。

KernelHook

KernelHook 可用于与远程 jupyter 内核交互。

RemoteKernelManager

连接到远程内核的 Jupyter 内核管理器。

RemoteKernelEngine

使用 RemoteKernelManager 连接到远程内核并执行 notebook 的 Papermill 引擎。

函数

register_remote_kernel_engine()

注册 RemoteKernelEngine papermill 引擎。

模块内容

airflow.providers.papermill.hooks.kernel.JUPYTER_KERNEL_SHELL_PORT = 60316[source]
airflow.providers.papermill.hooks.kernel.JUPYTER_KERNEL_IOPUB_PORT = 60317[source]
airflow.providers.papermill.hooks.kernel.JUPYTER_KERNEL_STDIN_PORT = 60318[source]
airflow.providers.papermill.hooks.kernel.JUPYTER_KERNEL_CONTROL_PORT = 60319[source]
airflow.providers.papermill.hooks.kernel.JUPYTER_KERNEL_HB_PORT = 60320[source]
airflow.providers.papermill.hooks.kernel.REMOTE_KERNEL_ENGINE = 'remote_kernel_engine'[source]
class airflow.providers.papermill.hooks.kernel.KernelConnection[source]

表示内核连接对象的类。

ip: str[source]
shell_port: int[source]
iopub_port: int[source]
stdin_port: int[source]
control_port: int[source]
hb_port: int[source]
session_key: str[source]
class airflow.providers.papermill.hooks.kernel.KernelHook(kernel_conn_id=default_conn_name, *args, **kwargs)[source]

基类: airflow.hooks.base.BaseHook

KernelHook 可用于与远程 jupyter 内核交互。

从连接中获取内核主机/IP,并引用 extra 字段中的 jupyter 内核端口和 session_key。

extra 字段中获取 jupyter 内核端口和 session_key。

参数

kernel_conn_id (str) – 包含内核主机/IP 的连接

conn_name_attr = 'kernel_conn_id'[source]
default_conn_name = 'jupyter_kernel_default'[source]
conn_type = 'jupyter_kernel'[source]
hook_name = 'Jupyter Kernel'[source]
kernel_conn[source]
get_conn()[source]

返回 Hook 的连接。

airflow.providers.papermill.hooks.kernel.register_remote_kernel_engine()[source]

注册 RemoteKernelEngine papermill 引擎。

class airflow.providers.papermill.hooks.kernel.RemoteKernelManager(*args, **kwargs)[source]

基类: jupyter_client.AsyncKernelManager

连接到远程内核的 Jupyter 内核管理器。

session_key[source]
property has_kernel: bool[source]

是否有已启动的内核进程正在被我们主动管理。

shutdown_kernel(now=False, restart=False)[source]
client(**kwargs)[source]

创建一个配置好连接到我们内核的客户端。

class airflow.providers.papermill.hooks.kernel.RemoteKernelEngine[source]

基类: papermill.engines.NBClientEngine

使用 RemoteKernelManager 连接到远程内核并执行 notebook 的 Papermill 引擎。

classmethod execute_managed_notebook(nb_man, kernel_name, log_output=False, stdout_file=None, stderr_file=None, start_timeout=60, execution_timeout=None, **kwargs)[source]

在本地执行参数化 notebook。

此条目是否有帮助?