How to use the @jupyterlab/services.Kernel.connectTo function in @jupyterlab/services

To help you get started, we’ve selected a few @jupyterlab/services examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jupyterlab / jupyterlab / tests / test-services / src / kernel / kernel.spec.ts View on Github external
it('should accept server settings', () => {
      const id = defaultKernel.id;
      const serverSettings = makeSettings();
      const kernel = Kernel.connectTo(defaultKernel.model, serverSettings);
      expect(kernel.id).to.equal(id);
      kernel.dispose();
    });
github jupyterlab / jupyterlab / tests / test-services / src / kernel / ikernel.spec.ts View on Github external
it('should dispose of all kernel instances', async () => {
      const kernel0 = await Kernel.startNew();
      const kernel1 = Kernel.connectTo(kernel0.model);
      await kernel0.ready;
      await kernel1.ready;
      await kernel0.shutdown();
      expect(kernel0.isDisposed).to.equal(true);
      expect(kernel1.isDisposed).to.equal(true);
    });
  });
github jupyterlab / jupyterlab-data-explorer / tests / test-services / src / kernel / ikernel.spec.ts View on Github external
it('should be safe to call multiple times', () => {
      const kernel = Kernel.connectTo(defaultKernel.model);
      expect(kernel.isDisposed).to.equal(false);
      expect(kernel.isDisposed).to.equal(false);
      kernel.dispose();
      expect(kernel.isDisposed).to.equal(true);
      expect(kernel.isDisposed).to.equal(true);
    });
  });
github jupyterlab / jupyterlab / tests / test-services / src / kernel / ikernel.spec.ts View on Github external
it('should be true after we dispose of the kernel', () => {
      const kernel = Kernel.connectTo(defaultKernel.model);
      expect(kernel.isDisposed).to.equal(false);
      kernel.dispose();
      expect(kernel.isDisposed).to.equal(true);
    });
github jupyterlab / jupyterlab-data-explorer / tests / test-services / src / kernel / kernel.spec.ts View on Github external
it('should accept server settings', () => {
      const id = defaultKernel.id;
      const serverSettings = makeSettings();
      const kernel = Kernel.connectTo(defaultKernel.model, serverSettings);
      expect(kernel.id).to.equal(id);
      kernel.dispose();
    });
  });
github jupyterlab / jupyterlab / tests / test-services / src / kernel / kernel.spec.ts View on Github external
it('should connect to an existing kernel', () => {
      const id = defaultKernel.id;
      const kernel = Kernel.connectTo(defaultKernel.model);
      expect(kernel.id).to.equal(id);
      kernel.dispose();
    });
github jupyterlab / jupyterlab / tests / test-services / src / kernel / ikernel.spec.ts View on Github external
it('should be safe to call twice', () => {
      const kernel = Kernel.connectTo(defaultKernel.model);
      const future = kernel.requestExecute({ code: 'foo' });
      expect(future.isDisposed).to.equal(false);
      kernel.dispose();
      expect(future.isDisposed).to.equal(true);
      expect(kernel.isDisposed).to.equal(true);
      kernel.dispose();
      expect(future.isDisposed).to.equal(true);
      expect(kernel.isDisposed).to.equal(true);
    });
  });
github voila-dashboards / voila / js / WidgetApplication.js View on Github external
async renderWidgets() {
        const baseUrl = PageConfig.getBaseUrl();
        const kernelId = PageConfig.getOption('kernelId');
        const connectionInfo = ServerConnection.makeSettings({baseUrl});

        let model = await Kernel.findById(kernelId, connectionInfo);
        let kernel = await Kernel.connectTo(model, connectionInfo);
        this._kernel = kernel;

        const manager = new WidgetManager(kernel, this._loader);
    }
github explosion / jupyterlab-prodigy / src / index.ts View on Github external
          .then(() => Kernel.connectTo(kernel.model))
          .then(kernel => {
github voila-dashboards / voila / js / src / kernel.js View on Github external
async function connectKernel(baseUrl, kernelId) {
    baseUrl = baseUrl || PageConfig.getBaseUrl();
    kernelId = kernelId || PageConfig.getOption('kernelId');
    const connectionInfo = ServerConnection.makeSettings({ baseUrl });

    let model = await Kernel.findById(kernelId, connectionInfo);
    let kernel = await Kernel.connectTo(model, connectionInfo);
    return kernel;
}