當前位置: 首頁>>代碼示例>>Python>>正文


Python jupyter_client.KernelManager方法代碼示例

本文整理匯總了Python中jupyter_client.KernelManager方法的典型用法代碼示例。如果您正苦於以下問題:Python jupyter_client.KernelManager方法的具體用法?Python jupyter_client.KernelManager怎麽用?Python jupyter_client.KernelManager使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在jupyter_client的用法示例。


在下文中一共展示了jupyter_client.KernelManager方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: start_kernel

# 需要導入模塊: import jupyter_client [as 別名]
# 或者: from jupyter_client import KernelManager [as 別名]
def start_kernel(self, name):
        """Start a new kernel"""
        base, ext = os.path.splitext(self.parent.connection_file)
        cf = '{base}-{name}{ext}'.format(
            base=base,
            name=name,
            ext=ext,
        )
        manager = KernelManager(
            kernel_name=name,
            session=self.session,
            context=self.future_context,
            connection_file=cf,
        )
        manager.start_kernel()
        self.kernels[name] = kernel = KernelProxy(
            manager=manager,
            shell_upstream=self.shell_stream)
        self.iosub.connect(kernel.iopub_url)
        return self.kernels[name] 
開發者ID:minrk,項目名稱:allthekernels,代碼行數:22,代碼來源:allthekernels.py

示例2: __init__

# 需要導入模塊: import jupyter_client [as 別名]
# 或者: from jupyter_client import KernelManager [as 別名]
def __init__(self, *args, **kwargs):
        super(FormatManager, self).__init__(*args, **kwargs)

        if self._instance is not None:
            raise ValueError("FormatManager is a singleton, access with"
                             " FormatManager.format_manager")

        self._formats = {}
        self._km = KernelManager() 
開發者ID:rossant,項目名稱:ipymd,代碼行數:11,代碼來源:format_manager.py

示例3: __init__

# 需要導入模塊: import jupyter_client [as 別名]
# 或者: from jupyter_client import KernelManager [as 別名]
def __init__(
        self,
        timeout: int = 100,
        template_type: TemplateType = TemplateType.FULL
    ):
        """
        Initializes Exporter with default timeout (100 seconds) and template
        (FULL) and handles instantiation of km and ep variables for usage when
        generating NotebookNodes and their outputs.

        Args:
            timeout (int): Amount of time in seconds that a visualization can
            run for before being stopped.
            template_type (TemplateType): Type of template to use when
            generating visualization output.
        """
        self.timeout = timeout
        self.template_type = template_type
        # Create custom KernelManager.
        # This will circumvent issues where kernel is shutdown after
        # preprocessing. Due to the shutdown, latency would be introduced
        # because a kernel must be started per visualization.
        self.km = KernelManager()
        self.km.start_kernel()
        self.ep = ExecutePreprocessor(
            timeout=self.timeout,
            kernel_name='python3',
            allow_errors=True
        ) 
開發者ID:kubeflow,項目名稱:pipelines,代碼行數:31,代碼來源:exporter.py


注:本文中的jupyter_client.KernelManager方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。