class_docstr: PerspectiveManager is an orchestrator for running Perspective on the
  server side.
  
  The core functionality resides in `process()`, which receives
  JSON-serialized messages from a client (implemented by `perspective-viewer`
  in the browser), executes the commands in the message, and returns the
  results of those commands back to the `post_callback`. Table instances
  should be passed to the manager using `host_table` - this allows server
  code to call Table APIs natively instead of proxying them through the
  Manager. Because Perspective is designed to be used in a shared context,
  i.e. multiple clients all accessing the same `Table`, PerspectiveManager
  comes with the context of `sessions` - an encapsulation of the actions
  and resources used by a single connection to Perspective, which can be
  cleaned up after the connection is closed.
  
  - When a client connects, for example through a websocket, a new session
      should be spawned using `new_session()`.
  - When the websocket closes, call `close()` on the session instance to
      clean up associated resources.
class_docstr_tok: ["PerspectiveManager","is","an","orchestrator","for","running","Perspective","on","the","server","side",".","The","core","functionality","resides","in","`","process","(",")","`",",","which","receives","JSON-serialized","messages","from","a","client","(","implemented","by","`","perspective-viewer","`","in","the","browser",")",",","executes","the","commands","in","the","message",",","and","returns","the","results","of","those","commands","back","to","the","`","post_callback","`",".","Table","instances","should","be","passed","to","the","manager","using","`","host_table","`","-","this","allows","server","code","to","call","Table","APIs","natively","instead","of","proxying","them","through","the","Manager",".","Because","Perspective","is","designed","to","be","used","in","a","shared","context",",","i.e",".","multiple","clients","all","accessing","the","same","`","Table","`",",","PerspectiveManager","comes","with","the","context","of","`","sessions","`","-","an","encapsulation","of","the","actions","and","resources","used","by","a","single","connection","to","Perspective",",","which","can","be","cleaned","up","after","the","connection","is","closed",".","-","When","a","client","connects",",","for","example","through","a","websocket",",","a","new","session","should","be","spawned","using","`","new_session","(",")","`",".","-","When","the","websocket","closes",",","call","`","close","(",")","`","on","the","session","instance","to","clean","up","associated","resources","."]
docstr: Sets this `PerspectiveManager` to run in Async mode, defering
  `update()` application and releasing the GIL for expensive operations.
  
  Once called, this `PerspectiveManager` and all Perspective objects it
  hosts must only be interacted with from the same thread.
  
  Args:
      loop_callback: A function which accepts a function reference and
          its args/kwargs, and schedules it to run on the same thread
          on which set_loop_callback()` was originally invoked.
      *args, **kwargs: Values to pass as the first arguments to every
          invocation of `loop_callbkac`, dsimilar to `functools.partial()`
docstr_tok: ["Sets","this","`","PerspectiveManager","`","to","run","in","Async","mode",",","defering","`","update","(",")","`","application","and","releasing","the","GIL","for","expensive","operations",".","Once","called",",","this","`","PerspectiveManager","`","and","all","Perspective","objects","it","hosts","must","only","be","interacted","with","from","the","same","thread",".","Args",":","loop_callback",":","A","function","which","accepts","a","function","reference","and","its","args\/kwargs",",","and","schedules","it","to","run","on","the","same","thread","on","which","set_loop_callback","(",")","`","was","originally","invoked",".","*","args",",","*","*","kwargs",":","Values","to","pass","as","the","first","arguments","to","every","invocation","of","`","loop_callbkac","`",",","dsimilar","to","`","functools.partial","(",")","`"]
code: def set_loop_callback(self, loop_callback, *args, **kwargs):
      """Sets this `PerspectiveManager` to run in Async mode, defering
      `update()` application and releasing the GIL for expensive operations.
  
      Once called, this `PerspectiveManager` and all Perspective objects it
      hosts must only be interacted with from the same thread.
  
      Args:
          loop_callback: A function which accepts a function reference and
              its args/kwargs, and schedules it to run on the same thread
              on which set_loop_callback()` was originally invoked.
          *args, **kwargs: Values to pass as the first arguments to every
              invocation of `loop_callbkac`, dsimilar to `functools.partial()`
      """
      if self._loop_callback is not None:
          raise PerspectiveError(
              "PerspectiveManager already has a `loop_callback`"
          )
      if len(args) > 0 or len(kwargs) > 0:
          loop_callback = partial(loop_callback, *args, **kwargs)
      if not callable(loop_callback):
          raise PerspectiveError("`loop_callback` must be a function")
      self._loop_callback = loop_callback
      for table in self._tables.values():
          table._state_manager.queue_process = partial(
              loop_callback, table._state_manager.call_process
          )
  
file_path: perspective/python/perspective/perspective/manager/manager.py
imports: import random
  import string
  from functools import partial
  from ..core.exception import PerspectiveError
  from ..table import Table
  from .manager_internal import _PerspectiveManagerInternal
  from .session import PerspectiveSession
label_desc: Use image node_id 10 for calling the PerspectiveManager obj's underlying member method code with example usage: obj.set_loop_callback(loop_callback) without return types