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 187 of file esMonitoring.py.

Constructor & Destructor Documentation

def esMonitoring.JsonInput.__init__ (   self)

Definition at line 188 of file esMonitoring.py.

189  def __init__(self):
190  self.buf = []
191  self.docs = []

Member Function Documentation

def esMonitoring.JsonInput.flush (   self)

Definition at line 223 of file esMonitoring.py.

224  def flush(self):
225  pass
def esMonitoring.JsonInput.get_doc (   self)

Definition at line 204 of file esMonitoring.py.

205  def get_doc(self):
206  return self.docs.pop(0)
def esMonitoring.JsonInput.have_docs (   self)

Definition at line 207 of file esMonitoring.py.

References esMonitoring.JsonInput.docs.

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

Definition at line 192 of file esMonitoring.py.

References esMonitoring.log().

Referenced by esMonitoring.JsonInput.write().

193  def parse_line(self, line):
194  if not line.strip():
195  # this is keep alive
196  # not yet implemented
197  return
198 
199  try:
200  doc = json.loads(line)
201  self.docs.append(doc)
202  except:
203  log("cannot deserialize json: %s" % line)
def esMonitoring.JsonInput.write (   self,
  rbuf 
)

Definition at line 210 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().

211  def write(self, rbuf):
212  self.buf.append(rbuf)
213  if "\n" in rbuf:
214  # split whatever we have
215  all = "".join(self.buf)
216  spl = all.split("\n")
217 
218  while len(spl) > 1:
219  line = spl.pop(0)
220  self.parse_line(line)
221 
222  self.buf = [spl[0]]
static std::string join(char **cmd)
Definition: RemoteFile.cc:18

Member Data Documentation

esMonitoring.JsonInput.buf

Definition at line 189 of file esMonitoring.py.

Referenced by esMonitoring.JsonInput.write().

esMonitoring.JsonInput.docs

Definition at line 190 of file esMonitoring.py.

Referenced by esMonitoring.JsonInput.have_docs().