當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。