How to use the @jupyterlab/services.Session.startNew 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-console / src / foreign.spec.ts View on Github external
before(async function() {
      // tslint:disable-next-line:no-invalid-this
      this.timeout(60000);

      const path = UUID.uuid4();
      [local, foreign, session] = await Promise.all([
        Session.startNew({ path }),
        Session.startNew({ path }),
        createClientSession({ path })
      ]);

      // check path prop
      expect(local.path).to.equal(path);

      await (session as ClientSession).initialize();
      await session.kernel.ready;
    });
github jupyterlab / jupyterlab / packages / services / examples / browser / src / index.ts View on Github external
function main() {
  // Start a new session.
  let options: Session.IOptions = {
    kernelName: 'python',
    path: 'foo.ipynb'
  };
  let session: Session.ISession;

  log('Starting session');
  Session.startNew(options)
    .then(s => {
      log('Session started');
      session = s;
      // Rename the session.
      return session.setPath('bar.ipynb');
    })
    .then(() => {
      log(`Session renamed to ${session.path}`);
      // Execute and handle replies on the kernel.
      let future = session.kernel.requestExecute({ code: 'a = 1' });
      future.onReply = reply => {
        log('Got execute reply');
      };
      return future.done;
    })
    .then(() => {
github jupyterlab / jupyterlab / tests / test-services / src / session / session.spec.ts View on Github external
it('should fail for wrong response status', async () => {
      const sessionModel = createSessionModel();
      const serverSettings = getRequestHandler(200, sessionModel);
      const options = createSessionOptions(sessionModel, serverSettings);
      const sessionPromise = Session.startNew(options);
      await expectFailure(sessionPromise);
    });
github yuvipanda / simplest-notebook / test / src / console / content.spec.ts View on Github external
beforeEach(done => {
      Session.startNew({ path: utils.uuid() }).then(newSession => {
        session = newSession;
        widget = new TestContent({ renderer, rendermime, session });
        done();
      });
    });
github jupyterlab / jupyterlab / tests / test-services / src / utils.ts View on Github external
async startSession(): Promise {
    handleRequest(this, 201, createSessionModel());
    const serverSettings = this.serverSettings;
    this._session = await Session.startNew({
      path: UUID.uuid4(),
      serverSettings
    });
    await this.ready;
    await this._session.kernel.ready;
    return this._session;
  }
github jupyterlab / jupyterlab / tests / test-services / src / session / isession.spec.ts View on Github external
function startNew(): Promise {
  return Session.startNew({ path: UUID.uuid4() });
}
github jupyterlab / jupyterlab / tests / test-services / src / session / session.spec.ts View on Github external
function startNew(): Promise {
  return Session.startNew({ path: UUID.uuid4() });
}
github jupyterlab / jupyterlab / tests / test-services / src / session / manager.spec.ts View on Github external
beforeAll(async () => {
    session = await Session.startNew({ path: UUID.uuid4() });
    await session.kernel.ready;
  });
github ParaToolsInc / taucmdr / jupyterlab / taucmdr_tam_pane / src / kernels.ts View on Github external
}, () => {
                let options: Session.IOptions = {
                    type: 'python2',
                    path: Kernels.session_path
                };
                return Session.startNew(options).then(s => {
                    this.session = s;
                    return this.session;
                }, r => {
                    throw new Error("Unable to start session")
                });
            })
        } else {
github nteract / hydrogen / lib / ws-kernel-picker.js View on Github external
startSession(gatewayName: string, sessionInfo: any) {
    Session.startNew(sessionInfo.options).then(
      this.onSessionChosen.bind(this, gatewayName)
    );
  }