class_docstr: Monitor to keep track of all clients using this service.
  
  This is only used for services that use multiple clients, e.g. the database
  service. In addition to tracking the original parent process, other
  processes can also request to be tracked by sending a message to this
  process as a tuple: ("register", PID). trigger_exit(PARENT) is only called
  after the original parent and all registered clients have shut down.
class_docstr_tok: ["Monitor","to","keep","track","of","all","clients","using","this","service",".","This","is","only","used","for","services","that","use","multiple","clients",",","e.g",".","the","database","service",".","In","addition","to","tracking","the","original","parent","process",",","other","processes","can","also","request","to","be","tracked","by","sending","a","message","to","this","process","as","a","tuple",":","(","``","register","''",",","PID",")",".","trigger_exit","(","PARENT",")","is","only","called","after","the","original","parent","and","all","registered","clients","have","shut","down","."]
docstr: Handles an incoming IPC message.
  
  This currently supports registering and unregistering clients.
  
  Args:
      message (tuple): a 2-item tuple (command: str, argument)
  
  Returns:
      response to send to the client (True on success, Exception on failure)
docstr_tok: ["Handles","an","incoming","IPC","message",".","This","currently","supports","registering","and","unregistering","clients",".","Args",":","message","(","tuple",")",":","a","2-item","tuple","(","command",":","str",",","argument",")","Returns",":","response","to","send","to","the","client","(","True","on","success",",","Exception","on","failure",")"]
code: def _handle_message(self, message):
      """Handles an incoming IPC message.
  
      This currently supports registering and unregistering clients.
  
      Args:
          message (tuple): a 2-item tuple (command: str, argument)
  
      Returns:
          response to send to the client (True on success, Exception on failure)
      """
      if not isinstance(message, tuple):
          raise TypeError("Expected tuple, got " + str(type(message)))
      command, arg = message
      with lock:
          if exiting.is_set():
              raise RuntimeError("service is exiting, cannot connect")
          if command == "register":
              process = psutil.Process(int(arg))
              with self.cond:
                  if process not in self.clients:
                      self.clients.add(process)
                      start_daemon_thread(
                          target=lambda: self._background_wait(process)
                      )
                  return True
          elif command == "unregister":
              process = psutil.Process(int(arg))
              self._notify_exit(process)
              return True
          else:
              raise ValueError("Unrecognized command: " + repr(command))
  
imports: import argparse
  import collections
  import enum
  import os
  import signal
  import subprocess
  import sys
  import threading
  import traceback
  import psutil
  from fiftyone.service.ipc import IPCServer
label_desc: Use image node_id 6 for calling the ClientMonitor obj's underlying member method code with example usage: obj._handle_message(message) and returns: True, True