当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript messaging.kernelInfoRequest函数代码示例

本文整理汇总了TypeScript中@nteract/messaging.kernelInfoRequest函数的典型用法代码示例。如果您正苦于以下问题:TypeScript kernelInfoRequest函数的具体用法?TypeScript kernelInfoRequest怎么用?TypeScript kernelInfoRequest使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了kernelInfoRequest函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: mergeMap

        mergeMap(data => {
          const session = data.response;

          const sessionId = castToSessionId(session.id);

          const kernel: RemoteKernelProps = Object.assign({}, session.kernel, {
            type: "websocket",
            info: null,
            sessionId,
            cwd,
            channels: kernels.connect(
              serverConfig,
              session.kernel.id,
              sessionId
            ),
            kernelSpecName
          });

          kernel.channels.next(kernelInfoRequest());

          return of(
            actions.launchKernelSuccessful({
              kernel,
              kernelRef,
              contentRef: action.payload.contentRef,
              selectNextKernel: true
            })
          );
        }),
开发者ID:nteract,项目名称:nteract,代码行数:29,代码来源:websocket-kernel.ts

示例2: switchMap

 switchMap(({ payload }) => {
   const { kernel, kernelName, serverId } = payload;
   // Side effect! Get that Kernel Info!
   kernel.channel.next(kernelInfoRequest());
   return kernel.channel.pipe(
     mergeMap((message: JupyterMessage<MessageType, any>) => {
       const actionsArray: Array<{
         type: string;
         payload: {
           serverId: string;
           kernelName: string;
           message?: JupyterMessage;
           status?: string;
         };
       }> = [actions.addKernelMessage({ serverId, kernelName, message })];
       switch (message.header.msg_type) {
         case "status":
           actionsArray.push(
             actions.setKernelStatus({
               serverId,
               kernelName,
               status: message.content.execution_state
             })
           );
           break;
         case "kernel_info_reply":
           actionsArray.push(
             actions.setActiveKernelLanguageInfo({
               serverId,
               kernelName,
               languageInfo: message.content.language_info
             })
           );
           break;
         case "display_data":
         case "execute_result":
         case "stream":
         case "error":
           actionsArray.push(
             actions.addKernelOutput({
               serverId,
               kernelName,
               output: {
                 ...message.content,
                 output_type: message.header.msg_type
               }
             })
           );
           break;
         default:
           break;
       }
       return from(actionsArray);
     })
   );
 })
开发者ID:nteract,项目名称:play,代码行数:56,代码来源:epics.ts

示例3: mergeMap

        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,
                kernelName,
                kernel
              })
            )
          );
        })
开发者ID:nteract,项目名称:play,代码行数:22,代码来源:epics.ts

示例4: async

    startKernel: async (parentValue: any, args: StartKernel) => {
      const kernel = await launchKernel(args.name);

      console.log(`kernel ${args.name}:${kernel.connectionInfo.key} launched`);

      // NOTE: we should generate IDs
      // We're also setting a session ID within the enchannel-zmq setup, I wonder
      // if we should use that
      const id = kernel.connectionInfo.key;

      messages[id] = [];
      kernels[id] = kernel;

      const subscription = kernel.channels.subscribe(
        (message: JupyterMessage) => {
          messages[id].push(message);
        }
      );

      const request = kernelInfoRequest();
      messages[id].push(request);
      kernel.channels.next(request);

      // NOTE: We are going to want to both:
      //
      //   subscription.unsubscribe()
      //   AND
      //   kernel.channels.complete()
      //
      //   Within our cleanup code

      return {
        id,
        status: "launched"
      };
    },
开发者ID:nteract,项目名称:kernel-relay,代码行数:36,代码来源:server.ts


注:本文中的@nteract/messaging.kernelInfoRequest函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。