CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes
esMonitoring.JsonInput Class Reference
Inheritance diagram for esMonitoring.JsonInput:

Public Member Functions

def __init__
 
def flush
 
def get_doc
 
def have_docs
 
def parse_line
 
def write
 

Public Attributes

 buf
 
 docs
 

Detailed Description

Definition at line 162 of file esMonitoring.py.

Constructor & Destructor Documentation

def esMonitoring.JsonInput.__init__ (   self)

Definition at line 163 of file esMonitoring.py.

164  def __init__(self):
165  self.buf = []
166  self.docs = []

Member Function Documentation

def esMonitoring.JsonInput.flush (   self)

Definition at line 198 of file esMonitoring.py.

199  def flush(self):
200  pass
def esMonitoring.JsonInput.get_doc (   self)

Definition at line 179 of file esMonitoring.py.

180  def get_doc(self):
181  return self.docs.pop(0)
def esMonitoring.JsonInput.have_docs (   self)

Definition at line 182 of file esMonitoring.py.

References esMonitoring.JsonInput.docs.

183  def have_docs(self):
184  return len(self.docs) > 0
def esMonitoring.JsonInput.parse_line (   self,
  line 
)

Definition at line 167 of file esMonitoring.py.

References esMonitoring.log().

Referenced by esMonitoring.JsonInput.write().

168  def parse_line(self, line):
169  if not line.strip():
170  # this is keep alive
171  # not yet implemented
172  return
173 
174  try:
175  doc = json.loads(line)
176  self.docs.append(doc)
177  except:
178  log("cannot deserialize json: %s" % line)
def esMonitoring.JsonInput.write (   self,
  rbuf 
)

Definition at line 185 of file esMonitoring.py.

References base64_decode_context.buf, esMonitoring.History.buf, esMonitoring.JsonInput.buf, join(), and esMonitoring.JsonInput.parse_line().

Referenced by pkg.AbstractPkg.generate().

186  def write(self, rbuf):
187  self.buf.append(rbuf)
188  if "\n" in rbuf:
189  # split whatever we have
190  all = "".join(self.buf)
191  spl = all.split("\n")
192 
193  while len(spl) > 1:
194  line = spl.pop(0)
195  self.parse_line(line)
196 
197  self.buf = [spl[0]]
static std::string join(char **cmd)
Definition: RemoteFile.cc:18

Member Data Documentation

esMonitoring.JsonInput.buf

Definition at line 164 of file esMonitoring.py.

Referenced by esMonitoring.JsonInput.write().

esMonitoring.JsonInput.docs

Definition at line 165 of file esMonitoring.py.

Referenced by esMonitoring.JsonInput.have_docs().