class_docstr: Extend IPython kernel for parallel computing
class_docstr_tok: ["Extend","IPython","kernel","for","parallel","computing"]
code: def apply_request(self, stream, ident, parent):
      try:
          content = parent["content"]
          bufs = parent["buffers"]
          msg_id = parent["header"]["msg_id"]
      except:
          self.log.error("Got bad msg: %s", parent, exc_info=True)
          return
  
      md = self.init_metadata(parent)
      reply_content, result_buf = self.do_apply(
          content, bufs, msg_id, md
      )
  
      # put 'ok'/'error' status in header, for scheduler introspection:
      md = self.finish_metadata(parent, md, reply_content)
  
      # flush i/o
      sys.stdout.flush()
      sys.stderr.flush()
      self.log.debug(f"Sending apply_reply: {msg_id}")
      self.session.send(
          stream,
          "apply_reply",
          reply_content,
          parent=parent,
          ident=ident,
          buffers=result_buf,
          metadata=md,
      )
  
imports: import asyncio
  import inspect
  import sys
  from functools import partial
  import ipykernel
  from ipykernel.ipkernel import IPythonKernel
  from traitlets import Integer, Type
  from ipyparallel.serialize import serialize_object, unpack_apply_message
  from ipyparallel.util import utcnow
  from .datapub import ZMQDataPublisher
label_desc: Use image node_id 9 for calling the IPythonParallelKernel obj's underlying member method code with example usage: obj.apply_request(stream, ident, parent) without return types