docstr: Create a JSONable cluster model
  
  Adds additional fields to make things easier on the client
docstr_tok: ["Create","a","JSONable","cluster","model","Adds","additional","fields","to","make","things","easier","on","the","client"]
code: def cluster_model(self, key, cluster):
      """Create a JSONable cluster model
  
      Adds additional fields to make things easier on the client
      """
      d = cluster.to_dict()
      profile_dir = d["cluster"]["profile_dir"]
      # provide abbreviated profile info
      d["cluster"]["profile"] = abbreviate_profile_dir(profile_dir)
  
      # top-level fields, added for easier client-side logic
      # add 'id' key, since typescript is bad at key-value pairs
      # so we return a list instead of a dict
      d["id"] = key
      # add total engine count
      d["engines"]["n"] = sum(
          es.get("n", 0) for es in d["engines"]["sets"].values()
      )
      # add cluster file
      d["cluster_file"] = cluster.cluster_file
      return d
  
file_path: ipyparallel/ipyparallel/nbextension/handlers.py
imports: import json
  import os
  from tornado import web
  from ..cluster import ClusterManager
  from ..util import abbreviate_profile_dir
  from .base import get_api_handler
label_desc: Use image node_id 2 for calling the ClusterHandler obj's underlying member method code with example usage: obj.cluster_model(key, cluster) and returns: d