HCE Project Python language Distributed Tasks Manager Application, Distributed Crawler Application and client API bindings.  2.0.0-chaika
Hierarchical Cluster Engine Python language binding
app.AdminInterfaceServer.AdminInterfaceServer Class Reference
Inheritance diagram for app.AdminInterfaceServer.AdminInterfaceServer:
Collaboration diagram for app.AdminInterfaceServer.AdminInterfaceServer:

Public Member Functions

def __init__ (self, configParser, connectionBuilderLight=None)
 
def onAdminState (self, event)
 
def onAdminStateResponse (self, event)
 
def onAdminStatData (self, event)
 
def onAdminStatDataResponse (self, event)
 
def onAdminGetConfigVars (self, event)
 
def onAdminGetConfigVarsResponse (self, event)
 
def onAdminSetConfigVars (self, event)
 
def onAdminSetConfigVarsResponse (self, event)
 
def onAdminSuspendResponse (self, event)
 
def processOwnStateRequest (self, event)
 
def processOwnStatDataRequest (self, event)
 
def getConnectionIdentityByEvent (self, event)
 
def processOwnGetConfigVarsRequest (self, event)
 
def processOwnSetConfigVarsRequest (self, event)
 
def onAdminSuspend (self, event)
 
def onAdminSystem (self, event)
 
def onAdminSQLCustom (self, event)
 
- Public Member Functions inherited from app.BaseServerManager.BaseServerManager
def __init__ (self, poller_manager=None, admin_connection=None, conectionLightBuilder=None, exceptionForward=False, dumpStatVars=True)
 constructor More...
 
def addConnection (self, name, connection)
 
def setEventHandler (self, eventType, handler)
 set event handler rewrite the current handler for eventType More...
 
def send (self, connect_name, event)
 send event More...
 
def reply (self, event, reply_event)
 wrapper for sending event in reply for event More...
 
def poll (self)
 poll function polling connections receive as multipart msg, the second argument is pickled pyobj More...
 
def process (self, event)
 process event call the event handler method that was set by user or on_unhandled_event method if not set More...
 
def run (self)
 
def is_connection_registered (self, name)
 check is a connection was registered in a instance of BaseServerManager i object More...
 
def on_poll_timeout (self)
 function will call every time when ConnectionTimeout exception arrive More...
 
def on_unhandled_event (self, event)
 function will call every time when arrive doesn't set handler for event type of event.evenType More...
 
def build_poller_list (self)
 
def clear_poller (self)
 
def onAdminState (self, event)
 onAdminState event handler process admin SHUTDOWN command More...
 
def onAdminFetchStatData (self, event)
 onAdminState event handler process admin command More...
 
def onAdminSuspend (self, event)
 onAdminState event handler process admin command More...
 
def getStatDataFields (self, fields)
 getStatDataFields returns stat data from storage More...
 
def getSystemStat (self)
 getSystemStat returns stat data for system indicators: RAMV, RAMR and CPU More...
 
def getConfigVarsFields (self, fields)
 getConfigVarsFields returns config vars from storage More...
 
def onAdminGetConfigVars (self, event)
 onAdminGetConfigVars event handler process getConfigVars admin command, fill and return config vars array from internal storage More...
 
def onAdminSetConfigVars (self, event)
 onAdminSetConfigVars event handler process setConfigVars admin command More...
 
def setConfigVars (self, setConfigVars)
 processSetConfigVars sets config vars in storage More...
 
def sendAdminReadyEvent (self)
 send ready event to notify adminInterfaceService More...
 
def createLogMsg (self, event)
 from string message from event object More...
 
def initStatFields (self, connect_name)
 add record in statFields More...
 
def updateStatField (self, field_name, value, operation=STAT_FIELDS_OPERATION_ADD)
 update values of stat field - default sum More...
 
def processSpecialConfigVars (self, name, value)
 send ready event to notify adminInterfaceService More...
 
def getLogLevel (self)
 Get log level from first of existing loggers. More...
 
def setLogLevel (self, level)
 Set log level for all loggers. More...
 
def saveStatVarsDump (self)
 Save stat vars in json file. More...
 
def loadStatVarsDump (self)
 Load stat vars in json file. More...
 
def getStatVarsDumpFileName (self)
 Get stat vars file name. More...
 
def createDBIDict (self, configParser)
 

Public Attributes

 adminServerClients
 
 dbi
 
 onSuspendConnectionIds
 
 onSuspendConnectionIdent
 
 onSuspendResponseDict
 
 tcpServerEventIdToConnectIdentity
 
 exit_flag
 
 serverHost
 
 serverPort
 
- Public Attributes inherited from app.BaseServerManager.BaseServerManager
 dumpStatVars
 
 poller_manager
 
 eventBuilder
 
 exit_flag
 
 pollTimeout
 
 connections
 
 event_handlers
 
 statFields
 stat fields container More...
 
 configVars
 
 exceptionForward
 

Static Public Attributes

string CONFIG_SERVER_HOST = "serverHost"
 
string CONFIG_SERVER_PORT = "serverPort"
 
string ERROR_EVENT_NOT_FOUND = "Event not found in queue"
 
string VERSION_STRING_NAME = "VERSION"
 
- Static Public Attributes inherited from app.BaseServerManager.BaseServerManager
string ADMIN_CONNECT_ENDPOINT = "Admin"
 
string ADMIN_CONNECT_CLIENT = "Admin"
 
int POLL_TIMEOUT_DEFAULT = 3000
 
int STAT_FIELDS_OPERATION_ADD = 0
 
int STAT_FIELDS_OPERATION_SUB = 1
 
int STAT_FIELDS_OPERATION_SET = 2
 
int STAT_FIELDS_OPERATION_INIT = 3
 
string POLL_TIMEOUT_CONFIG_VAR_NAME = "POLL_TIMEOUT"
 
string LOG_LEVEL_CONFIG_VAR_NAME = "LOG_LEVEL"
 
string STAT_DUMPS_DEFAULT_DIR = "/tmp/"
 
string STAT_DUMPS_DEFAULT_NAME = "%APP_NAME%_%CLASS_NAME%_stat_vars.dump"
 
dictionary LOGGERS_NAMES = {APP_CONSTS.LOGGER_NAME, "dc", "dtm", "root", ""}
 

Detailed Description

Definition at line 41 of file AdminInterfaceServer.py.

Constructor & Destructor Documentation

◆ __init__()

def app.AdminInterfaceServer.AdminInterfaceServer.__init__ (   self,
  configParser,
  connectionBuilderLight = None 
)

Definition at line 57 of file AdminInterfaceServer.py.

57  def __init__(self, configParser, connectionBuilderLight=None):
58  super(AdminInterfaceServer, self).__init__()
59 
60  # Admin server connection clients dic, format [className]=connect_identity
61  self.adminServerClients = {}
62 
63  # #@var dbi
64  # db contains two tables log and backlog
65  try:
66  self.dbi = DBI(self.createDBIDict(configParser))
67  except Exception:
68  self.dbi = None
69 
70  # Suspend responses list, identity and results dict
71  self.onSuspendConnectionIds = {}
72  self.onSuspendConnectionIdent = None
73  self.onSuspendResponseDict = {}
74 
75  # TCP server events to client identity cross reference dic, format [event_id]=connect_identity
76  self.tcpServerEventIdToConnectIdentity = {}
77 
78  # Instantiate the connection builder light if not set
79  if connectionBuilderLight is None:
80  connectionBuilderLight = ConnectionBuilderLight()
81 
82  className = self.__class__.__name__
83  self.exit_flag = False
84 
85  # Get configuration settings
86  self.serverHost = configParser.get(className, self.CONFIG_SERVER_HOST)
87  self.serverPort = configParser.get(className, self.CONFIG_SERVER_PORT)
88 
89  # Create connections and raise bind or connect actions for correspondent connection type
90  tcpServerConnection = connectionBuilderLight.build(TRANSPORT_CONSTS.SERVER_CONNECT,
91  self.serverHost + ":" + self.serverPort,
92  TRANSPORT_CONSTS.TCP_TYPE)
93  adminServerConnection = connectionBuilderLight.build(TRANSPORT_CONSTS.SERVER_CONNECT,
94  BaseServerManager.ADMIN_CONNECT_ENDPOINT)
95 
96  # Add connections to the polling set
97  self.addConnection(BaseServerManager.ADMIN_CONNECT_ENDPOINT, adminServerConnection)
98  self.addConnection(self.serverHost, tcpServerConnection)
99 
100  # Set event handler for ADMIN_FETCH_STAT_DATA event
101  self.setEventHandler(DTM_CONSTS.EVENT_TYPES.ADMIN_FETCH_STAT_DATA, self.onAdminStatData)
102  # Set event handler for ADMIN_FETCH_STAT_DATA_RESPONSE event
103  self.setEventHandler(DTM_CONSTS.EVENT_TYPES.ADMIN_FETCH_STAT_DATA_RESPONSE, self.onAdminStatDataResponse)
104  # Set event handler for ADMIN_STATE event
105  self.setEventHandler(DTM_CONSTS.EVENT_TYPES.ADMIN_STATE, self.onAdminState)
106  # Set event handler for ADMIN_STATE_RESPONSE event
107  self.setEventHandler(DTM_CONSTS.EVENT_TYPES.ADMIN_STATE_RESPONSE, self.onAdminStateResponse)
108  # Set event handler for ADMIN_GET_CONFIG_VARS event
109  self.setEventHandler(DTM_CONSTS.EVENT_TYPES.ADMIN_GET_CONFIG_VARS, self.onAdminGetConfigVars)
110  # Set event handler for ADMIN_GET_CONFIG_VARS_RESPONSE event
111  self.setEventHandler(DTM_CONSTS.EVENT_TYPES.ADMIN_GET_CONFIG_VARS_RESPONSE, self.onAdminGetConfigVarsResponse)
112  # Set event handler for ADMIN_SET_CONFIG_VARS event
113  self.setEventHandler(DTM_CONSTS.EVENT_TYPES.ADMIN_SET_CONFIG_VARS, self.onAdminSetConfigVars)
114  # Set event handler for ADMIN_SET_CONFIG_VARS_RESPONSE event
115  self.setEventHandler(DTM_CONSTS.EVENT_TYPES.ADMIN_SET_CONFIG_VARS_RESPONSE, self.onAdminSetConfigVarsResponse)
116  # Set event handler for ADMIN_SUSPEND event
117  self.setEventHandler(DTM_CONSTS.EVENT_TYPES.ADMIN_SUSPEND, self.onAdminSuspend)
118  # Set event handler for ADMIN_SUSPEND_RESPONSE event
119  self.setEventHandler(DTM_CONSTS.EVENT_TYPES.ADMIN_SUSPEND_RESPONSE, self.onAdminSuspendResponse)
120  # Set event handler for ADMIN_SYSTEM event
121  self.setEventHandler(DTM_CONSTS.EVENT_TYPES.ADMIN_SYSTEM, self.onAdminSystem)
122  # Set event handler for ADMIN_SYSTEM event
123  self.setEventHandler(DTM_CONSTS.EVENT_TYPES.ADMIN_SQL_CUSTOM, self.onAdminSQLCustom)
124  # Version string init in config vars
125  self.configVars[self.VERSION_STRING_NAME] = APP_CONSTS.VERSION_STRING
126  # Version string init in stat vars
127  self.statFields[self.VERSION_STRING_NAME] = APP_CONSTS.VERSION_STRING
128 
129 
130 
def __init__(self)
constructor
Definition: UIDGenerator.py:19

Member Function Documentation

◆ getConnectionIdentityByEvent()

def app.AdminInterfaceServer.AdminInterfaceServer.getConnectionIdentityByEvent (   self,
  event 
)

Definition at line 393 of file AdminInterfaceServer.py.

393  def getConnectionIdentityByEvent(self, event):
394  connect_identity = None
395 
396  try:
397  # Set connect identity from dic
398  connect_identity = self.tcpServerEventIdToConnectIdentity.pop(event.uid)
399  except Exception, e:
400  logger.error(LogFormatterEvent(event, [], self.ERROR_EVENT_NOT_FOUND + " : " + e.__doc__ + " : " + e.message))
401 
402  return connect_identity
403 
404 
Here is the caller graph for this function:

◆ onAdminGetConfigVars()

def app.AdminInterfaceServer.AdminInterfaceServer.onAdminGetConfigVars (   self,
  event 
)

Definition at line 238 of file AdminInterfaceServer.py.

238  def onAdminGetConfigVars(self, event):
239  try:
240  # get event object
241  adminConfigVars = event.eventObj
242  if adminConfigVars.className == self.__class__.__name__:
243  # Process himself instance
244  logger.debug("Process GET_CONGIG_VARS request for himself!")
245  self.processOwnGetConfigVarsRequest(event)
246  else:
247  if adminConfigVars.className in self.adminServerClients:
248  # Store event information in the queue
249  self.tcpServerEventIdToConnectIdentity[event.uid] = event.connect_identity
250  # Build new event with the same structure
251  requestEvent = self.eventBuilder.build(DTM_CONSTS.EVENT_TYPES.ADMIN_GET_CONFIG_VARS, adminConfigVars)
252  # Set the same uid to have a possibility to identify the reply
253  requestEvent.uid = event.uid
254  # Set connect identity from registered clients
255  requestEvent.connect_identity = self.adminServerClients[adminConfigVars.className]
256  # Send event to the internal Admin connection for target class as third parameter
257  self.send(BaseServerManager.ADMIN_CONNECT_ENDPOINT, requestEvent)
258  else:
259  logger.debug("Wrong name of target class [" + adminConfigVars.className + "]")
260  except Exception as err:
261  ExceptionLog.handler(logger, err, "Exception:")
262 
263 
264 
Here is the call graph for this function:

◆ onAdminGetConfigVarsResponse()

def app.AdminInterfaceServer.AdminInterfaceServer.onAdminGetConfigVarsResponse (   self,
  event 
)

Definition at line 268 of file AdminInterfaceServer.py.

268  def onAdminGetConfigVarsResponse(self, event):
269  try:
270  # Get event object
271  adminConfigVars = event.eventObj
272  # Create new event
273  replyEvent = self.eventBuilder.build(DTM_CONSTS.EVENT_TYPES.ADMIN_GET_CONFIG_VARS_RESPONSE, adminConfigVars)
274  # Set reply event uid from source request event
275  replyEvent.uid = event.uid
276  # Set connect_identity from events dict by event.uid
277  replyEvent.connect_identity = self.getConnectionIdentityByEvent(event)
278  if replyEvent.connect_identity is not None:
279  self.send(self.serverHost, replyEvent)
280  except Exception as err:
281  ExceptionLog.handler(logger, err, "Exception:")
282 
283 
Here is the call graph for this function:

◆ onAdminSetConfigVars()

def app.AdminInterfaceServer.AdminInterfaceServer.onAdminSetConfigVars (   self,
  event 
)

Definition at line 287 of file AdminInterfaceServer.py.

287  def onAdminSetConfigVars(self, event):
288  try:
289  # get event object
290  adminConfigVars = event.eventObj
291  if adminConfigVars.className == self.__class__.__name__:
292  # Process himself instance
293  logger.debug("Process SET_CONFIG_VARS request for himself!")
294  self.processOwnSetConfigVarsRequest(event)
295  else:
296  if adminConfigVars.className in self.adminServerClients:
297  # Store event information in the queue
298  self.tcpServerEventIdToConnectIdentity[event.uid] = event.connect_identity
299  # Build new event with the same structure
300  requestEvent = self.eventBuilder.build(DTM_CONSTS.EVENT_TYPES.ADMIN_SET_CONFIG_VARS, adminConfigVars)
301  # Set the same uid to have a possibility to identify the reply
302  requestEvent.uid = event.uid
303  # Set connect identity from registered clients
304  requestEvent.connect_identity = self.adminServerClients[adminConfigVars.className]
305  # Send event to the internal Admin connection for target class as third parameter
306  self.send(BaseServerManager.ADMIN_CONNECT_ENDPOINT, requestEvent)
307  else:
308  logger.debug("Wrong name of target class [" + adminConfigVars.className + "]!")
309  except Exception as err:
310  ExceptionLog.handler(logger, err, "Exception:")
311 
312 
Here is the call graph for this function:

◆ onAdminSetConfigVarsResponse()

def app.AdminInterfaceServer.AdminInterfaceServer.onAdminSetConfigVarsResponse (   self,
  event 
)

Definition at line 316 of file AdminInterfaceServer.py.

316  def onAdminSetConfigVarsResponse(self, event):
317  try:
318  # Get event object
319  adminConfigVars = event.eventObj
320  # Create new event
321  replyEvent = self.eventBuilder.build(DTM_CONSTS.EVENT_TYPES.ADMIN_SET_CONFIG_VARS_RESPONSE, adminConfigVars)
322  # Set reply event uid from source request event
323  replyEvent.uid = event.uid
324  # Set connect_identity from events dict by event.uid
325  replyEvent.connect_identity = self.getConnectionIdentityByEvent(event)
326  if replyEvent.connect_identity is not None:
327  self.send(self.serverHost, replyEvent)
328  except Exception as err:
329  ExceptionLog.handler(logger, err, "Exception:")
330 
331 
Here is the call graph for this function:

◆ onAdminSQLCustom()

def app.AdminInterfaceServer.AdminInterfaceServer.onAdminSQLCustom (   self,
  event 
)

Definition at line 487 of file AdminInterfaceServer.py.

487  def onAdminSQLCustom(self, event):
488  logger.debug(">>> onAdminSQLCustom uid = " + str(event.uid))
489  responseObj = dtm.EventObjects.CustomResponse(event.eventObj.rid, event.eventObj.query, "dtm")
490  try:
491  if self.dbi is not None:
492  sqlResponse = self.dbi.sqlCustom(event.eventObj.query)
493  responseObj.result = [dict(row) for row in sqlResponse]
494  if self.dbi.errorCode != DBI_CONSTANTS.DBI_SUCCESS_CODE:
495  responseObj.errString = self.dbi.errorMessage
496  except Exception as err:
497  ExceptionLog.handler(logger, err, "onAdminSQLCustom:")
498  replyEvent = self.eventBuilder.build(DTM_CONSTS.EVENT_TYPES.ADMIN_SQL_CUSTOM_RESPONSE, responseObj)
499  self.reply(event, replyEvent)
Here is the call graph for this function:

◆ onAdminStatData()

def app.AdminInterfaceServer.AdminInterfaceServer.onAdminStatData (   self,
  event 
)

Definition at line 187 of file AdminInterfaceServer.py.

187  def onAdminStatData(self, event):
188  try:
189  # get event object
190  adminStatData = event.eventObj
191  if adminStatData.className == self.__class__.__name__:
192  # Process himself instance
193  logger.debug("Process STAT request for himself!")
194  self.processOwnStatDataRequest(event)
195  else:
196  if adminStatData.className in self.adminServerClients:
197  logger.debug("Forward the STAT request for target class [" + adminStatData.className + "]!")
198  # Store event information in the queue
199  self.tcpServerEventIdToConnectIdentity[event.uid] = event.connect_identity
200  # Build new event with the same structure
201  requestEvent = self.eventBuilder.build(DTM_CONSTS.EVENT_TYPES.ADMIN_FETCH_STAT_DATA, adminStatData)
202  # Set the same uid to have a possibility to identify the reply
203  requestEvent.uid = event.uid
204  # Set connect identity from registered clients
205  requestEvent.connect_identity = self.adminServerClients[adminStatData.className]
206  # Send event to the internal Admin connection for target class as third parameter
207  self.send(BaseServerManager.ADMIN_CONNECT_ENDPOINT, requestEvent)
208  else:
209  # Received wrong class name, do nothing to push the timeout on client-side
210  # TODO: Create right response with error message
211  logger.debug("Requested STAT request for unregistered class [" + adminStatData.className + "]!")
212  except Exception as err:
213  ExceptionLog.handler(logger, err, "Exception:")
214 
215 
Here is the call graph for this function:

◆ onAdminStatDataResponse()

def app.AdminInterfaceServer.AdminInterfaceServer.onAdminStatDataResponse (   self,
  event 
)

Definition at line 219 of file AdminInterfaceServer.py.

219  def onAdminStatDataResponse(self, event):
220  try:
221  # Get event object
222  adminStatData = event.eventObj
223  # Create new event
224  replyEvent = self.eventBuilder.build(DTM_CONSTS.EVENT_TYPES.ADMIN_FETCH_STAT_DATA_RESPONSE, adminStatData)
225  # Set reply event uid from source request event
226  replyEvent.uid = event.uid
227  # Set connect_identity from events dict by event.uid
228  replyEvent.connect_identity = self.getConnectionIdentityByEvent(event)
229  if replyEvent.connect_identity is not None:
230  self.send(self.serverHost, replyEvent)
231  except Exception as err:
232  ExceptionLog.handler(logger, err, "Exception:")
233 
234 
Here is the call graph for this function:

◆ onAdminState()

def app.AdminInterfaceServer.AdminInterfaceServer.onAdminState (   self,
  event 
)

Definition at line 134 of file AdminInterfaceServer.py.

134  def onAdminState(self, event):
135  try:
136  # get event object
137  adminState = event.eventObj
138  if adminState.className == self.__class__.__name__:
139  # Process himself instance
140  self.processOwnStateRequest(event)
141  else:
142  # Store event information in the queue
143  self.tcpServerEventIdToConnectIdentity[event.uid] = event.connect_identity
144  # Build new event with the same structure
145  requestEvent = self.eventBuilder.build(DTM_CONSTS.EVENT_TYPES.ADMIN_STATE, adminState)
146  # Set the same uid to have a possibility to identify the reply
147  requestEvent.uid = event.uid
148  if adminState.className in self.adminServerClients:
149  # Set connect identity from registered clients
150  requestEvent.connect_identity = self.adminServerClients[adminState.className]
151  # Send event to the internal Admin connection for target class as third parameter
152  self.send(BaseServerManager.ADMIN_CONNECT_ENDPOINT, requestEvent)
153  else:
154  logger.info("Class instance [" + adminState.className + "] not found ")
155  except Exception as err:
156  ExceptionLog.handler(logger, err, "Exception:")
157 
158 
Here is the call graph for this function:

◆ onAdminStateResponse()

def app.AdminInterfaceServer.AdminInterfaceServer.onAdminStateResponse (   self,
  event 
)

Definition at line 162 of file AdminInterfaceServer.py.

162  def onAdminStateResponse(self, event):
163  try:
164  # Get event object
165  adminState = event.eventObj
166  if adminState.command == dtm.EventObjects.AdminState.STATE_READY:
167  # Process READY state, remember connection identity
168  self.adminServerClients[adminState.className] = event.connect_identity
169  logger.info("Class instance [" + adminState.className + "] registered!")
170  else:
171  # Create new event
172  replyEvent = self.eventBuilder.build(DTM_CONSTS.EVENT_TYPES.ADMIN_STATE_RESPONSE, adminState)
173  # Set reply event uid from source request event
174  replyEvent.uid = event.uid
175  # Set connect_identity from events dict by event.uid
176  replyEvent.connect_identity = self.getConnectionIdentityByEvent(event)
177  if replyEvent.connect_identity is not None:
178  self.send(self.serverHost, replyEvent)
179  logger.info("Response to admin client sent!")
180  except Exception as err:
181  ExceptionLog.handler(logger, err, "Exception:")
182 
183 
Here is the call graph for this function:

◆ onAdminSuspend()

def app.AdminInterfaceServer.AdminInterfaceServer.onAdminSuspend (   self,
  event 
)

Definition at line 431 of file AdminInterfaceServer.py.

431  def onAdminSuspend(self, event):
432  try:
433  if len(self.onSuspendConnectionIds) > 0:
434  responseObj = dtm.EventObjects.GeneralResponse(dtm.EventObjects.GeneralResponse.ERROR_OK,
435  ">>> Suspend already in progress")
436  replyEvent = self.eventBuilder.build(DTM_CONSTS.EVENT_TYPES.ADMIN_SUSPEND_RESPONSE, responseObj)
437  replyEvent.connect_identity = event.connect_identity
438  if replyEvent.connect_identity is not None:
439  self.send(self.serverHost, replyEvent)
440  else:
441  suspendObj = event.eventObj
442  for clientName in self.adminServerClients:
443  self.onSuspendConnectionIdent = event.connect_identity
444  # Build new event with the same structure
445  requestEvent = self.eventBuilder.build(DTM_CONSTS.EVENT_TYPES.ADMIN_SUSPEND, suspendObj)
446  # Set connect identity from registered clients
447  requestEvent.connect_identity = self.adminServerClients[clientName]
448  # Store event information in the queue
449  self.onSuspendConnectionIds[requestEvent.uid] = requestEvent.connect_identity
450  # Send event to the internal Admin connection for target class as third parameter
451  self.send(BaseServerManager.ADMIN_CONNECT_ENDPOINT, requestEvent)
452  logger.debug(">>> SuspendRequest uid = " + str(requestEvent.uid))
453  except Exception as err:
454  ExceptionLog.handler(logger, err, "Exception:")
455 
456 
GeneralResponse event object, represents general state response for multipurpose usage.
Here is the call graph for this function:

◆ onAdminSuspendResponse()

def app.AdminInterfaceServer.AdminInterfaceServer.onAdminSuspendResponse (   self,
  event 
)

Definition at line 335 of file AdminInterfaceServer.py.

335  def onAdminSuspendResponse(self, event):
336  logger.debug(">>> SuspendResponse uid = " + str(event.uid))
337  if event.uid in self.onSuspendConnectionIds:
338  for key in self.adminServerClients.keys():
339  if self.adminServerClients[key] == self.onSuspendConnectionIds[event.uid]:
340  self.onSuspendResponseDict[key] = event.eventObj.errorMessage
341  del self.onSuspendConnectionIds[event.uid]
342  if len(self.onSuspendConnectionIds) == 0:
343  responseObj = dtm.EventObjects.GeneralResponse(dtm.EventObjects.GeneralResponse.ERROR_OK, "All thread response")
344  responseObj.statuses.append(self.onSuspendResponseDict)
345  replyEvent = self.eventBuilder.build(DTM_CONSTS.EVENT_TYPES.ADMIN_SUSPEND_RESPONSE, responseObj)
346  replyEvent.connect_identity = self.onSuspendConnectionIdent
347  if replyEvent.connect_identity is not None:
348  self.send(self.serverHost, replyEvent)
349  self.onSuspendConnectionIdent = None
350  self.onSuspendResponseDict = {}
351 
352 
GeneralResponse event object, represents general state response for multipurpose usage.
Here is the call graph for this function:

◆ onAdminSystem()

def app.AdminInterfaceServer.AdminInterfaceServer.onAdminSystem (   self,
  event 
)

Definition at line 460 of file AdminInterfaceServer.py.

460  def onAdminSystem(self, event):
461  logger.debug(">>> onAdminSystem uid = " + str(event.uid))
462  try:
463  if event.eventObj.type is None:
464  raise Exception('Wrong event data were got: ' + varDump(event))
465 
466  systemCommand = SystemCommandHandler(logger)
467  errorCode = systemCommand.execute(event.eventObj.type, event.eventObj.data)
468  errorMessage = ''
469  if errorCode == dtm.EventObjects.GeneralResponse.ERROR_OK:
470  errorMessage = ">>> SystemCommand successfully finished"
471  else:
472  errorMessage = systemCommand.errorMsg
473 
474  responseObj = dtm.EventObjects.GeneralResponse(errorCode, errorMessage)
475  replyEvent = self.eventBuilder.build(DTM_CONSTS.EVENT_TYPES.ADMIN_SYSTEM_RESPONSE, responseObj)
476  replyEvent.connect_identity = event.connect_identity
477  if replyEvent.connect_identity is not None:
478  self.send(self.serverHost, replyEvent)
479 
480  except Exception as err:
481  ExceptionLog.handler(logger, err, "onAdminSystem:")
482 
483 
GeneralResponse event object, represents general state response for multipurpose usage.
def varDump(obj, stringify=True, strTypeMaxLen=256, strTypeCutSuffix='...', stringifyType=1, ignoreErrors=False, objectsHash=None, depth=0, indent=2, ensure_ascii=False, maxDepth=10)
Definition: Utils.py:410
Here is the call graph for this function:

◆ processOwnGetConfigVarsRequest()

def app.AdminInterfaceServer.AdminInterfaceServer.processOwnGetConfigVarsRequest (   self,
  event 
)

Definition at line 408 of file AdminInterfaceServer.py.

408  def processOwnGetConfigVarsRequest(self, event):
409  adminConfigVars = event.eventObj
410  # Fill regular fields
411  adminConfigVars.fields = self.getConfigVarsFields(adminConfigVars.fields)
412  # Reply the same object
413  replyEvent = self.eventBuilder.build(DTM_CONSTS.EVENT_TYPES.ADMIN_GET_CONFIG_VARS_RESPONSE, adminConfigVars)
414  self.reply(event, replyEvent)
415 
416 
Here is the call graph for this function:
Here is the caller graph for this function:

◆ processOwnSetConfigVarsRequest()

def app.AdminInterfaceServer.AdminInterfaceServer.processOwnSetConfigVarsRequest (   self,
  event 
)

Definition at line 420 of file AdminInterfaceServer.py.

420  def processOwnSetConfigVarsRequest(self, event):
421  adminConfigVars = event.eventObj
422  # Reply the same object
423  replyEvent = self.eventBuilder.build(DTM_CONSTS.EVENT_TYPES.ADMIN_SET_CONFIG_VARS_RESPONSE,
424  self.setConfigVars(adminConfigVars))
425  self.reply(event, replyEvent)
426 
427 
Here is the call graph for this function:
Here is the caller graph for this function:

◆ processOwnStatDataRequest()

def app.AdminInterfaceServer.AdminInterfaceServer.processOwnStatDataRequest (   self,
  event 
)

Definition at line 370 of file AdminInterfaceServer.py.

370  def processOwnStatDataRequest(self, event):
371  adminStatData = event.eventObj
372  fieldsListLen = len(adminStatData.fields)
373  # Fill regular fields
374  adminStatData.fields = self.getStatDataFields(adminStatData.fields)
375  # Fill the FIELD_CLIENTS_LIST if defined in requested fields list or it is empty
376  if dtm.EventObjects.AdminStatData.FIELD_CLIENTS_LIST in adminStatData.fields or fieldsListLen == 0:
377  # Fill the clients list as classes names
378  clientsList = []
379  for key in self.adminServerClients.keys():
380  clientsList.append(key)
381  adminStatData.fields[dtm.EventObjects.AdminStatData.FIELD_CLIENTS_LIST] = clientsList
382  # Reply the same object
383  replyEvent = self.eventBuilder.build(DTM_CONSTS.EVENT_TYPES.ADMIN_FETCH_STAT_DATA_RESPONSE, adminStatData)
384  self.reply(event, replyEvent)
385 
386 
Here is the call graph for this function:
Here is the caller graph for this function:

◆ processOwnStateRequest()

def app.AdminInterfaceServer.AdminInterfaceServer.processOwnStateRequest (   self,
  event 
)

Definition at line 356 of file AdminInterfaceServer.py.

356  def processOwnStateRequest(self, event):
357  adminState = event.eventObj
358  if adminState.command == dtm.EventObjects.AdminState.STATE_SHUTDOWN:
359  # Reply the same object
360  replyEvent = self.eventBuilder.build(DTM_CONSTS.EVENT_TYPES.ADMIN_STATE_RESPONSE, adminState)
361  self.reply(event, replyEvent)
362  logger.info("Has successfully shutdown!")
363  # Shutdown himself
364  self.exit_flag = True
365 
366 
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ adminServerClients

app.AdminInterfaceServer.AdminInterfaceServer.adminServerClients

Definition at line 61 of file AdminInterfaceServer.py.

◆ CONFIG_SERVER_HOST

string app.AdminInterfaceServer.AdminInterfaceServer.CONFIG_SERVER_HOST = "serverHost"
static

Definition at line 44 of file AdminInterfaceServer.py.

◆ CONFIG_SERVER_PORT

string app.AdminInterfaceServer.AdminInterfaceServer.CONFIG_SERVER_PORT = "serverPort"
static

Definition at line 45 of file AdminInterfaceServer.py.

◆ dbi

app.AdminInterfaceServer.AdminInterfaceServer.dbi

Definition at line 66 of file AdminInterfaceServer.py.

◆ ERROR_EVENT_NOT_FOUND

string app.AdminInterfaceServer.AdminInterfaceServer.ERROR_EVENT_NOT_FOUND = "Event not found in queue"
static

Definition at line 47 of file AdminInterfaceServer.py.

◆ exit_flag

app.AdminInterfaceServer.AdminInterfaceServer.exit_flag

Definition at line 83 of file AdminInterfaceServer.py.

◆ onSuspendConnectionIdent

app.AdminInterfaceServer.AdminInterfaceServer.onSuspendConnectionIdent

Definition at line 72 of file AdminInterfaceServer.py.

◆ onSuspendConnectionIds

app.AdminInterfaceServer.AdminInterfaceServer.onSuspendConnectionIds

Definition at line 71 of file AdminInterfaceServer.py.

◆ onSuspendResponseDict

app.AdminInterfaceServer.AdminInterfaceServer.onSuspendResponseDict

Definition at line 73 of file AdminInterfaceServer.py.

◆ serverHost

app.AdminInterfaceServer.AdminInterfaceServer.serverHost

Definition at line 86 of file AdminInterfaceServer.py.

◆ serverPort

app.AdminInterfaceServer.AdminInterfaceServer.serverPort

Definition at line 87 of file AdminInterfaceServer.py.

◆ tcpServerEventIdToConnectIdentity

app.AdminInterfaceServer.AdminInterfaceServer.tcpServerEventIdToConnectIdentity

Definition at line 76 of file AdminInterfaceServer.py.

◆ VERSION_STRING_NAME

string app.AdminInterfaceServer.AdminInterfaceServer.VERSION_STRING_NAME = "VERSION"
static

Definition at line 49 of file AdminInterfaceServer.py.


The documentation for this class was generated from the following file: