How to use the @jupyterlab/services.Session.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 / session / session.spec.ts View on Github external
it('should accept server settings', () => {
      const serverSettings = makeSettings();
      const session = Session.connectTo(defaultSession.model, serverSettings);
      expect(session.id).to.be.ok;
    });
  });
github jupyterlab / jupyterlab / tests / test-services / src / session / session.spec.ts View on Github external
it('should connect to a running session', () => {
      const newSession = Session.connectTo(defaultSession.model);
      expect(newSession.id).to.equal(defaultSession.id);
      expect(newSession.kernel.id).to.equal(defaultSession.kernel.id);
      expect(newSession).to.not.equal(defaultSession);
      expect(newSession.kernel).to.not.equal(defaultSession.kernel);
    });
github jupyterlab / jupyterlab / tests / test-services / src / session / isession.spec.ts View on Github external
it('should dispose of all session instances', async () => {
        const session0 = await startNew();
        const session1 = Session.connectTo(session0.model);
        await session0.shutdown();
        expect(session1.isDisposed).to.equal(true);
      });
    });
github jupyterlab / jupyterlab-data-explorer / tests / test-services / src / session / isession.spec.ts View on Github external
it('should fail if the session is disposed', async () => {
        const session = Session.connectTo(defaultSession.model);
        session.dispose();
        const promise = session.setPath(UUID.uuid4());
        await expectFailure(promise, 'Session is disposed');
      });
    });
github jupyterlab / jupyterlab-data-explorer / tests / test-services / src / session / isession.spec.ts View on Github external
it('should dispose of all session instances', async () => {
        const session0 = await startNew();
        const session1 = Session.connectTo(session0.model);
        await session0.shutdown();
        expect(session1.isDisposed).to.equal(true);
      });
    });
github jupyterlab / jupyterlab / tests / test-services / src / session / isession.spec.ts View on Github external
it('should be true after we dispose of the session', () => {
        const session = Session.connectTo(defaultSession.model);
        expect(session.isDisposed).to.equal(false);
        session.dispose();
        expect(session.isDisposed).to.equal(true);
      });
github jupyterlab / jupyterlab-data-explorer / tests / test-services / src / session / isession.spec.ts View on Github external
it('should fail if the session is disposed', async () => {
        const session = Session.connectTo(defaultSession.model);
        session.dispose();
        await expectFailure(session.shutdown(), 'Session is disposed');
      });
github timkpaine / nannotate / packages / core / src / datamanager.ts View on Github external
Session.listRunning().then(sessionModels => {
                for (let i=0; i {
                            console.log('comm msg');
                            let dat = msg['content']['data'];
                            let event = new MessageEvent('msg', {data:dat});
                            this.open(event);
                        };
                        this._ws.onClose = () => {
                            console.log('comm closed');
                            this.close(new CloseEvent('close'))
                        };
                        this._ws.open('opened');
                    }
                }
            });
github ParaToolsInc / taucmdr / jupyterlab / taucmdr_tam_pane / src / kernels.ts View on Github external
return Session.findByPath(Kernels.session_path).then(model => {
                return Session.connectTo(model.id).then(s => {
                    this.session = s;
                    return this.session;
                });
            }, () => {
                let options: Session.IOptions = {
github nteract / hydrogen / lib / ws-kernel-picker.js View on Github external
name: spec.display_name,
          options
        };
      });

      this.listView.onConfirmed = this.startSession.bind(this, gatewayName);
      await this.listView.selectListView.update({
        items: items,
        emptyMessage: "No kernel specs available",
        infoMessage: "Select a session",
        loadingMessage: null
      });
    } else {
      this.onSessionChosen(
        gatewayName,
        await Session.connectTo(sessionInfo.model.id, sessionInfo.options)
      );
    }
  }