class_docstr: The server maintains the port and hands off the requests to workers
  
  example of use:
  
  context = zmq.Context()
  with KnimeBridgeServer(
      context,
      "tcp://127.0.0.1:4000", # server address
      "inproc://Notify        # kill notify address
      ) as server:
      notify_socket = context.socket(zmq.PUB)
      notify_socket.bind("inproc://Notify")
      ....
      notify_socket.send("Stop")
class_docstr_tok: ["The","server","maintains","the","port","and","hands","off","the","requests","to","workers","example","of","use",":","context","=","zmq.Context","(",")","with","KnimeBridgeServer","(","context",",","``","tcp",":","\/\/127.0.0.1:4000","''",",","#","server","address","``","inproc",":","\/\/Notify","#","kill","notify","address",")","as","server",":","notify_socket","=","context.socket","(","zmq.PUB",")","notify_socket.bind","(","``","inproc",":","\/\/Notify","''",")","....","notify_socket.send","(","``","Stop","''",")"]
docstr: Handle the run request message
docstr_tok: ["Handle","the","run","request","message"]
code: def run_request(self, session_id, message_type, message):
      """Handle the run request message"""
      pipeline, m, object_set = self.prepare_run(message, session_id)
      if pipeline is None:
          return
      m[
          "Image",
          GROUP_NUMBER,
      ] = 1
      m[
          "Image",
          GROUP_INDEX,
      ] = 1
      input_modules, other_modules = self.split_pipeline(pipeline)
      for module in other_modules:
          workspace = cellprofiler_core.workspace.Workspace(
              pipeline, module, m, None, m, None
          )
          module.prepare_run(workspace)
      for module in other_modules:
          workspace = cellprofiler_core.workspace.Workspace(
              pipeline, module, m, object_set, m, None
          )
          try:
              LOGGER.info(
                  "Running module # %d: %s"
                  % (module.module_num, module.module_name)
              )
              pipeline.run_module(module, workspace)
              if workspace.disposition in (
                  DISPOSITION_SKIP,
                  DISPOSITION_CANCEL,
              ):
                  break
          except Exception as e:
              msg = (
                  'Encountered error while running module, "%s": %s'
                  % (
                      module.module_name,
                      e,
                  )
              )
              LOGGER.warning(msg)
              self.raise_cellprofiler_exception(session_id, msg)
              return
      type_names, feature_dict = self.find_measurements(
          other_modules, pipeline
      )
  
      double_features = []
      double_data = []
      float_features = []
      float_data = []
      int_features = []
      int_data = []
      string_features = []
      string_data = []
      metadata = [
          double_features,
          float_features,
          int_features,
          string_features,
      ]
  
      no_data = ()
  
      for object_name, features in list(feature_dict.items()):
          df = []
          double_features.append((object_name, df))
          ff = []
          float_features.append((object_name, ff))
          intf = []
          int_features.append((object_name, intf))
          sf = []
          string_features.append((object_name, sf))
          for feature, data_type in features:
              if not m.has_feature(object_name, feature):
                  data = no_data
              else:
                  data = numpy.atleast_1d(m[object_name, feature])
              if type_names[data_type] == "java.lang.Double":
                  df.append((feature, len(data)))
                  if len(data) > 0:
                      double_data.append(data.astype("<f8"))
              elif type_names[data_type] == "java.lang.Float":
                  ff.append((feature, len(data)))
                  if len(data) > 0:
                      float_data.append(data.astype("<f4"))
              elif type_names[data_type] == "java.lang.Integer":
                  intf.append((feature, len(data)))
                  if len(data) > 0:
                      int_data.append(data.astype("<i4"))
              elif type_names[data_type] == "java.lang.String":
                  if len(data) == 0:
                      sf.append((feature, 0))
                  else:
                      s = data[0]
                      if isinstance(s, str):
                          s = s
                      else:
                          s = str(s)
                      string_data.append(
                          numpy.frombuffer(s, numpy.uint8)
                      )
      data = numpy.hstack(
          [
              numpy.frombuffer(numpy.hstack(ditem).data, numpy.uint8)
              for ditem in (
                  double_data,
                  float_data,
                  int_data,
                  string_data,
              )
              if len(ditem) > 0
          ]
      )
      self.socket.send_multipart(
          [
              zmq.Frame(session_id),
              zmq.Frame(),
              zmq.Frame(RUN_REPLY_1),
              zmq.Frame(json.dumps(metadata)),
              zmq.Frame(bytes(data.data)),
          ]
      )
  
imports: import json
  import logging
  import threading
  import uuid
  from io import StringIO
  import numpy
  import zmq
  from cellprofiler_core.constants.measurement import GROUP_NUMBER, GROUP_INDEX, OBJECT_NUMBER, EXPERIMENT, MCA_AVAILABLE_POST_RUN, COLTYPE_FLOAT, COLTYPE_INTEGER, COLTYPE_VARCHAR, IMAGE_NUMBER
  from cellprofiler_core.constants.workspace import DISPOSITION_SKIP, DISPOSITION_CANCEL
  from cellprofiler_core.image import Image
  from cellprofiler_core.measurement import Measurements
  from cellprofiler_core.module import Module
  from cellprofiler_core.setting.text import ImageName
  import cellprofiler_core.object
  import cellprofiler_core.pipeline
  import cellprofiler_core.workspace
label_desc: Use image node_id 9 for calling the KnimeBridgeServer obj's underlying member method code with example usage: obj.run_request(session_id, message_type, message) without return types