How to use enchannel-zmq-backend - 8 common examples

To help you get started, we’ve selected a few enchannel-zmq-backend 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 / applications / desktop / src / notebook / epics / zeromq-kernels.ts View on Github external
"color: black"
          );

          spawn.stdout?.on("data", data => {
            const text = data.toString();
            logStd(text);
            observer.next(actions.kernelRawStdout({ text, kernelRef }));
          });
          spawn.stderr?.on("data", data => {
            const text = data.toString();
            logStd(text);
            observer.next(actions.kernelRawStderr({ text, kernelRef }));
          });

          // do dependency injection of jmp to make it match our ABI version of node
          const channels = await createMainChannel(
            config,
            undefined,
            undefined,
            undefined,
            jmp
          );
          observer.next(
            actions.setKernelspecInfo({
              contentRef,
              kernelInfo: kernelSpec
            })
          );

          const kernel: LocalKernelProps = {
            info: null,
            type: "zeromq",
github nteract / nteract / applications / desktop / src / notebook / epics / zeromq-kernels.ts View on Github external
"color: black"
          );

          spawn.stdout.on("data", data => {
            const text = data.toString();
            logStd(text);
            observer.next(actions.kernelRawStdout({ text, kernelRef }));
          });
          spawn.stderr.on("data", data => {
            const text = data.toString();
            logStd(text);
            observer.next(actions.kernelRawStderr({ text, kernelRef }));
          });

          // do dependency injection of jmp to make it match our ABI version of node
          const channels = await createMainChannel(
            config,
            undefined,
            undefined,
            undefined,
            jmp
          );
          observer.next(
            actions.setKernelspecInfo({
              contentRef,
              kernelInfo: { name: kernelSpec.name, ...kernelSpec.spec }
            })
          );

          const kernel: LocalKernelProps = {
            info: null,
            type: "zeromq",
github nteract / ick / index.js View on Github external
};

      const childMessages = shell.filter(isChildMessage.bind(completeRequest));

      const completeReply = childMessages
                              .filter(msg => msg.header.msg_type === 'complete_reply')
                              .map(msg => msg.content);

      completeReply.subscribe(content => {
        callback(null, [content.matches, line]);
      });

      shell.next(completeRequest);
    });

    const iopub = enchannel.createIOPubSubject(identity, c.config);

    marked.setOptions({
      renderer: new TerminalRenderer(),
    });

    var counter = 1;

    rl.setPrompt(chalk.blue(`ick${langInfo.file_extension}:${counter}> `));
    rl.prompt();

    // Instantiate a string buffer for accumulating incomplete code strings
    var buffer = "";

    rl.on('line', (line) => {
      const isCompleteRequest = createMessage('is_complete_request');
      isCompleteRequest.content = {
github nteract / nteract / packages / fs-kernels / src / spawnteract.ts View on Github external
);

  const runningKernel: execa.ExecaChildProcess = execa(
    argv[0],
    argv.slice(1),
    fullSpawnOptions
  );

  if (fullSpawnOptions.cleanupConnectionFile !== false) {
    runningKernel.on("exit", (code, signal) => cleanup(connectionFile));
    runningKernel.on("error", error => cleanup(connectionFile));
  }

  const channels: Subject<
    JupyterMessage
  > = await createMainChannel(config);

  return {
    channels,
    config,
    connectionFile,
    kernelSpec,
    spawn: runningKernel
  };
}
github makebrainwaves / BrainWaves / app / epics / jupyterEpics.js View on Github external
    mergeMap(kernel => from(createMainChannel(kernel.config))),
    tap(mainChannel => mainChannel.next(executeRequest(imports()))),
github nteract / ick / index.js View on Github external
function main(c) {
  const identity = uuid.v4();
  const shell = enchannel.createShellSubject(identity, c.config);
  const stdin = enchannel.createStdinSubject(identity, c.config);

  const session = uuid.v4();

  function createMessage(msg_type) {
    const username = process.env.LOGNAME || process.env.USER ||
                     process.env.LNAME || process.env.USERNAME;
    return {
      header: {
        username,
        session,
        msg_type,
        msg_id: uuid.v4(),
        date: new Date(),
        version: '5.0',
      },
github nteract / ick / index.js View on Github external
function main(c) {
  const identity = uuid.v4();
  const shell = enchannel.createShellSubject(identity, c.config);
  const stdin = enchannel.createStdinSubject(identity, c.config);

  const session = uuid.v4();

  function createMessage(msg_type) {
    const username = process.env.LOGNAME || process.env.USER ||
                     process.env.LNAME || process.env.USERNAME;
    return {
      header: {
        username,
        session,
        msg_type,
        msg_id: uuid.v4(),
        date: new Date(),
        version: '5.0',
      },
      metadata: {},
github nteract / nteract / applications / desktop / __mocks__ / enchannel-zmq-backend.ts View on Github external
async createMainChannel() {
    const shellSocket = new HokeySocket();
    const iopubSocket = new HokeySocket();
    const sockets = {
      shell: shellSocket,
      iopub: iopubSocket
    };

    const channels = await createMainChannelFromSockets(sockets, {
      session: "spinning",
      username: "dj"
    });

    return channels;
  }
};

enchannel-zmq-backend

Channeling jupyter over zmq

BSD-3-Clause
Latest version published 4 years ago

Package Health Score

51 / 100
Full package analysis