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
admin.NodeManager Namespace Reference

Classes

class  NodeManager
 NodeManager represents API for interraction with user-side (execute method) More...
 

Functions

def responsesParsing (self)
 responsesParsing method parses data from self.responses into specific stucture (self.responsesDicts) More...
 
def execute (self, commands, nodes)
 execute method execute incoming commands on nodes, keepts reult in responses and responsesDicts fields More...
 

Variables

 responses
 
 responsesDicts
 

Detailed Description

Created on Feb 17, 2014

@author: scorp
@link: http://hierarchical-cluster-engine.com/
@copyright: Copyright © 2013-2014 IOIX Ukraine
@license: http://hierarchical-cluster-engine.com/license/
@since: 0.1

Function Documentation

◆ execute()

def admin.NodeManager.execute (   self,
  commands,
  nodes 
)

execute method execute incoming commands on nodes, keepts reult in responses and responsesDicts fields

Definition at line 63 of file NodeManager.py.

63  def execute(self, commands, nodes):
64  self.responses = []
65  self.responsesDicts = []
66  message = {CONSTANTS.STRING_MSGID_NAME : "", CONSTANTS.STRING_BODY_NAME : ""}
67  for node in nodes:
68  for command in commands:
69  responseElement = {CONSTANTS.STRING_NODE_MARKER : node, CONSTANTS.STRING_RESPONSE_MARKER : None}
70  requestBody = command.generateBody()
71  if requestBody != None:
72  message[CONSTANTS.STRING_MSGID_NAME] = self.msgUidGenerator.get_uid()
73  message[CONSTANTS.STRING_BODY_NAME] = requestBody
74  try:
75  response = self.request.makeRequest(node, message, command.getRequestTimeout())
76  except AdminExceptions.AdminWrongConnectionKey:
77  errorStr = "ERR_AdminWrongConnectionKey"
78  response = NodeManagerResponse(errorStr)
79  except AdminExceptions.AdminTimeoutException:
80  errorStr = "ERR_AdminTimeoutException"
81  response = NodeManagerResponse(errorStr)
82  responseElement[CONSTANTS.STRING_RESPONSE_MARKER] = response
83  self.responses.append(responseElement)
84 
85  self.responsesParsing()
86 
def makeRequest(self, node, message, commandTimeout=None)
makeRequest main class method, it gets node and message params, interact with transport layer...
def get_uid(self, idType=0)
get_uid
Definition: UIDGenerator.py:31
def execute(self, commands, nodes)
execute method execute incoming commands on nodes, keepts reult in responses and responsesDicts field...
Definition: NodeManager.py:63
Here is the caller graph for this function:

◆ responsesParsing()

def admin.NodeManager.responsesParsing (   self)

responsesParsing method parses data from self.responses into specific stucture (self.responsesDicts)

Definition at line 40 of file NodeManager.py.

40  def responsesParsing(self):
41  for responseElement in self.responses:
42  responsesDict = None
43  responseBody = responseElement[CONSTANTS.STRING_RESPONSE_MARKER].getBody()
44  if type(responseBody) == type(""):
45  fieldsList = responseBody.split(CONSTANTS.ITEM_DELIM)
46  if len(fieldsList) > 1:
47  if fieldsList[0] != CONSTANTS.ERROR_CODE_OK and fieldsList[0] != CONSTANTS.ERROR_CODE_ERROR:
48  self.responsesDicts.append(responsesDict)
49  continue
50  responsesDict = {CONSTANTS.RESPONSE_CODE_NAME: "", CONSTANTS.RESPONSE_FIELDS_NAME: {}}
51  responsesDict[CONSTANTS.RESPONSE_CODE_NAME] = fieldsList[0]
52  for i in xrange(1, len(fieldsList)):
53  field = fieldsList[i].split(CONSTANTS.FIELD_DELIM)
54  fieldValue = ""
55  if len(field) > 1:
56  fieldValue = field[1]
57  if len(field) > 0:
58  responsesDict[CONSTANTS.RESPONSE_FIELDS_NAME][field[0]] = fieldValue
59  self.responsesDicts.append(responsesDict)
60 
61 
def responsesParsing(self)
responsesParsing method parses data from self.responses into specific stucture (self.responsesDicts)
Definition: NodeManager.py:40
Here is the caller graph for this function:

Variable Documentation

◆ responses

admin.NodeManager.responses

Definition at line 64 of file NodeManager.py.

◆ responsesDicts

admin.NodeManager.responsesDicts

Definition at line 65 of file NodeManager.py.