How to use the rx-jupyter.kernels.start function in rx-jupyter

To help you get started, we’ve selected a few rx-jupyter 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 nteract / nteract / packages / host-cache / src / components / kernel.tsx View on Github external
allocate = () => {
    // Set up a closure around the current props, for determining if we should really update state
    const { kernelName, host, cwd } = this.props;
    const { endpoint, token } = this.props.host;

    kernels.start(host, kernelName, cwd).subscribe(
      xhr => {
        this.setState(
          (
            _prevState: KernelAllocatorState,
            currentProps: KernelAllocatorProps
          ) => {
            // Ensure that the props haven't changed on us midway -- if they have,
            // we shouldn't try to connect to our (now) old kernel
            if (
              currentProps.kernelName !== kernelName ||
              currentProps.cwd !== cwd ||
              currentProps.host.endpoint !== endpoint ||
              currentProps.host.token !== token
            ) {
              console.log(
                "Props changed while in the middle of starting a kernel, assuming that another kernel is starting up"
github nteract / nteract / packages / host-cache / src / components / kernel.tsx View on Github external
allocate = () => {
    // Set up a closure around the current props, for determining if we should really update state
    const { kernelName, host, cwd } = this.props;
    const { endpoint, token } = this.props.host;

    kernels.start(host, kernelName, cwd).subscribe(
      xhr => {
        this.setState(
          (
            _prevState: KernelAllocatorState,
            currentProps: KernelAllocatorProps
          ) => {
            // Ensure that the props haven't changed on us midway -- if they have,
            // we shouldn't try to connect to our (now) old kernel
            if (
              currentProps.kernelName !== kernelName ||
              currentProps.cwd !== cwd ||
              currentProps.host.endpoint !== endpoint ||
              currentProps.host.token !== token
            ) {
              console.log(
                "Props changed while in the middle of starting a kernel, assuming that another kernel is starting up"
github nteract / nteract / packages / epics / src / websocket-kernel.ts View on Github external
if (!sessionId) {
        return empty();
      }

      const content = selectors.content(state, { contentRef });
      if (!content || content.type !== "notebook") {
        return empty();
      }
      const {
        filepath,
        model: { notebook }
      } = content;
      const { cwd } = extractNewKernel(filepath, notebook);

      const kernelRef = createKernelRef();
      return kernels.start(serverConfig, kernelSpecName, cwd).pipe(
        mergeMap(({ response }) => {
          const { id: kernelId } = response;
          const sessionPayload = {
            kernel: { id: kernelId, name: kernelSpecName }
          };
          // The sessions API will close down the old kernel for us if it is
          // on this session
          return sessions.update(serverConfig, sessionId, sessionPayload).pipe(
            mergeMap(({ response: session }) => {
              const kernel: RemoteKernelProps = Object.assign(
                {},
                session.kernel,
                {
                  type: "websocket",
                  sessionId,
                  cwd,
github nteract / nteract / packages / core / src / epics / websocket-kernel.js View on Github external
if (!sessionId) {
        return empty();
      }

      const content = selectors.content(state, { contentRef });
      if (!content || content.type !== "notebook") {
        return empty();
      }
      const {
        filepath,
        model: { notebook }
      } = content;
      const { cwd } = extractNewKernel(filepath, notebook);

      const kernelRef = createKernelRef();
      return kernels.start(serverConfig, kernelSpecName, cwd).pipe(
        mergeMap(({ response }) => {
          const { id: kernelId } = response;
          const sessionPayload = {
            kernel: { id: kernelId, name: kernelSpecName }
          };
          // The sessions API will close down the old kernel for us if it is
          // on this session
          return sessions.update(serverConfig, sessionId, sessionPayload).pipe(
            mergeMap(({ response: session }) => {
              const kernel: RemoteKernelProps = Object.assign(
                {},
                session.kernel,
                {
                  type: "websocket",
                  sessionId,
                  cwd,
github nteract / nteract / applications / play / redux / epics.js View on Github external
mergeMap(({ payload: { serverId, kernelName } }) => {
      const configPath = [
        "entities",
        "serversById",
        serverId,
        "server",
        "config"
      ];
      const config = objectPath.get(state$.value, configPath);
      return kernels.start(config, kernelName, "").pipe(
        mergeMap(data => {
          const session = uuid();
          const kernel = Object.assign({}, data.response, {
            channel: kernels.connect(
              config,
              data.response.id,
              session
            )
          });

          kernel.channel.next(kernelInfoRequest());

          return merge(
            of(
              actions.activateKernelFulfilled({
                serverId,